One Quickie


non-const pointer error (Errors->General)
Got an error that smells like "pointer to non-const type 'GRSpotifyLoginCompletion' (aka 'void (^)(BOOL)') with no explicit ownership"? Check to see you don't have too many stars.

For example,

typedef void (^GRSpotifyLoginCompletion) (BOOL loggedIn);
@property (strong, nonatomic) NSMutableArray *loginCompletions;

...

    for (GRSpotifyLoginCompletion *completion in self.loginCompletions) {
        completion(success);
    }
This generates the error. The problem is the star before completion in the fast-enumeration loop. GRSpotifyLoginCompletion is already a pointers due to its nature of being a block typedef. The code above is saying "hey, this completion thing is a pointer to a pointer", which ARC doesn't know how to handle.



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com