__block HAAppDelegate *appDelegate = self;
getNewMessages = ^{
if ([FBSession.activeSession isOpen]) {
HANetworkRequest *request = [[HANetworkRequest alloc] initWithDelegate:appDelegate];
[request doRequest:@"getNotifications"];
}
};
assigning to 'NSBlockOperation *__strong' from incompatible type 'void (^)(void)'
getNewMessages = ^{
^ ~~
答案 0 :(得分:1)
根据编译错误getNewMessages
是一个NSBlockOperation
对象,而不是ObjectiveC的块。所以你应该按照以下方式使用它:
getNewMessages = [NSBlockOperation blockOperationWithBlock:^{
if ([FBSession.activeSession isOpen]) {
HANetworkRequest *request = [[HANetworkRequest alloc] initWithDelegate:appDelegate];
[request doRequest:@"getNotifications"];
}];