osx - Objective C singleton class members -


this mac os x app. have created singleton class, i'm not sure how add class members (not sure if correct term). getting error property 'chorddictionary' not found on object of type '__strong id' , i'm not sure why. want create nsdictionary can access via class. here's code:

#import "chordtype.h"  @interface chordtype()  @property nsdictionary *chorddictionary;  @end  @implementation chordtype  + (instancetype)sharedchorddata {     static id sharedinstance = nil;      static dispatch_once_t oncetoken;     dispatch_once(&oncetoken, ^{         sharedinstance = [[self alloc] init];         sharedinstance.chorddictionary = @{@"" : @"047", @"m" : @"037", @"dim" : @"036", @"aug" : @"048",}; //error on line     });      return sharedinstance; }  @end 

declare sharedinstance chordtype * instead of id or call setchorddictionary: method instead of using property syntax. can't use property syntax on variables of type id.

either:

static chordtype *sharedinstance = nil; 

or:

[sharedinstance setchorddictionary:@{@"" : @"047", @"m" : @"037", @"dim" : @"036", @"aug" : @"048"}]; 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -