Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - member reference is a pointer?

Tags:

ios

iphone

ipad

I am trying to assign a AVAudioPlayer to a property using this

NSURL *soundURL = [[NSBundle mainBundle] URLForResource:@"error"
                                          withExtension:@"aiff"];
AVAudioPlayer *avSound = [[AVAudioPlayer alloc]
           initWithContentsOfURL:soundURL error:nil];
self.soundError = avSound;

I am receiving an error on the last line saying: member reference type 'struct objc_class *' is a pointer; maybe you meant use '->' ?

the property is declared like

@property (nonatomic, strong) AVAudioPlayer *soundError;

pointer? I don't get it.

thanks

like image 838
Duck Avatar asked Nov 30 '22 14:11

Duck


1 Answers

You did not post your full method but the error may indicate that you're trying to assign property in the class method, not in an instance method.

Check if your method declaration is correct - probably it should be

- (void) someMethod

instead of

+ (void) someMethod
like image 117
Vladimir Avatar answered Dec 06 '22 23:12

Vladimir