ChuckKelly ChuckKelly - 1 year ago 81
Objective-C Question

Using Defined Constants that will show up via autosuggest as Keys in a array

Was having trouble keeping track of my users NSUserDefualts, so I decided it makes sense to define a .h that will hold ALL my NSUserDefualts user_session vars that way there is never any confusion or any mistakes.Here was my attempt:

#import <Foundation/Foundation.h>

@interface UserSessionConstants : NSObject

#define user_device_udid @"user_device_udid";
#define user_uid @"user_uid";
#define user_full_name @"user_fullname";
#define user_first_name @"user_first_name";
#define user_last_name @"user_last_name";
#define user_cover_photo @"user_cover_photo";
#define user_default_photo @"user_default_photo";
#define user_udid @"user_udid";

#define user_isEmailConfirmed @"user_isEmailConfirmed";
#define user_isCollegeActive @"user_isCollegeActive";

#define user_draft_status_text @"session_draft_status_text";
#define user_draft_image_url @"session_draft_image_url";

but, for some reason I get a error when trying to use any of these like so:

enter image description here

is there really no way to define a auto suggesting constant that is usable as a key? I have already tried extern, so far it has not worked for me and does not always autosuggest.

Answer Source

Delete ; in the end of all define.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download