zakdances
zakdances

Reputation: 23685

Why is my block declaration giving me an incompatible pointer error?

I'm declaring a block like this:

void (^callback)(NSString *_accessToken) = ^{
  // do something interesting with _accessToken
}

but XCode keeps telling me

Incompatible block pointer types initializing void(^__strong)(NSString *__strong)
with an expression of type void (^)(void)

What am I doing wrong?

Upvotes: 2

Views: 533

Answers (1)

msk
msk

Reputation: 8905

void (^callback)(NSString *) = ^(NSString *_accessToken){
  // do something interesting with _accessToken
}

Upvotes: 4

Related Questions