我有以下代码:
- (void) likeImage:(AHInstagramImageData *) image
success:(void (^)(BOOL success))success
failure:(void (^)(NSError* error, NSInteger statusCode))failure
{
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
[AHInstagramSession session].accessToken, @"access_token",
nil];
NSString *likeCommentPath = [NSString stringWithFormat:@"media/%@/likes", image.imageId];
[self postPath:likeCommentPath parameters:params success:^(AFHTTPRequestOperation *operation, id response){
if ([operation hasAcceptableStatusCode]) {
[[LocalyticsSession sharedLocalyticsSession] tagEvent:@"Like"];
[[AHFacebookSession session] postAction:@"like" forImageData:image];
[[AHTwitterSession session] postAction:@"like" andObject:image];
success(YES);
}failure:^(AFHTTPRequestOperation *operation, NSError *error){
failure(error, operation.response.statusCode);
NSLog(@"Failure on liking a photo %@", [error description]);
}];
}
它给了我错误:
答案 0 :(得分:1)
看起来不像是内存问题。检查success
块是否在您调用之前实际设置了。
if (success)
{
success(YES);
}