objective-cpropertiesbooleanprotocolssynthesize

Can't Set Protocol's Synthesized Property Boolean


I have a class SSENoteTrack that conforms to two protocols, SSETrack and SSENoteContainer. Both of those protocols declare an @property in the interface file:

@property (nonatomic, assign, getter = isMuted) BOOL muted;

In SSENoteTrack.h, I synthesize the property.

@synthesize muted;

On an instance of SSENoteTrack, the property starts as nil. I try to set it in another class' code like so:

[track setMuted:YES]

I can set the property to YES just fine. However, I can't set the property to NO. e.g. After the line [track setMuted:NO], track.isMuted returns nil.

Quite a strange issue. Perhaps it's because of the way my protocol is set up? Thanks!


Solution

  • Yep, I'm an idiot. See this SO post: https://stackoverflow.com/a/4289697/1539826. I was typing po in lldb to check isMuted, rather than p and that's why I was getting nil not 0.