我有一个共享扩展中的AFNetworking的问题.在didSelectPost中,我打电话:
[[AuthClient sharedClient] POST: @"/v1/events" parameters: params success: ^ (AFHTTPRequestOperation * operation,id responSEObject) { [self.extensionContext completeRequestReturningItems: nil completionHandler: nil]; } failure: ^ (AFHTTPRequestOperation * operation,NSError * error) { NSLog(@"error: %@",error); [self.extensionContext cancelRequestWithError: error]; } ];
[AuthClient sharedClient]使用单例模式获取具有背景标识符的NSURLSessionConfiguration的AFHTTPSessionManager实例.
但是,无论是成功还是失败的回调都被调用,它将无限期挂起,直到扩展被杀死.有趣的是,HTTP请求在服务器端完成;完成从未被调用.