我不确定应该如何使用来自新AFNetworking的showAlertViewForRequestOperationWithErrorOnCompletion
。我尝试了以下操作,但没有显示alertView。
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id requestObject) {
// ...
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[UIAlertView showAlertViewForRequestOperationWithErrorOnCompletion:operation
delegate:nil];
}];
答案 0 :(得分:1)
<强>更新强>
好的,所以implementation看来调用它并不会立即显示警报,而只是将其设置好以便在操作失败时显示警报。所以你可能需要这样做:
[UIAlertView showAlertViewForRequestOperationWithErrorOnCompletion:requestOperation
delegate:nil];
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id requestObject) {
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}];