我不确定如何使用新 AFNetworking 中的 showAlertViewForRequestOperationWithErrorOnCompletion
。我尝试了以下操作,但没有显示alertView。
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id requestObject) {
// ...
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[UIAlertView showAlertViewForRequestOperationWithErrorOnCompletion:operation
delegate:nil];
}];
最佳答案
- 您确定已到达该代码行吗?
- 仅当操作错误非零时才会显示警报。您确定是这样吗?
更新:
好的,看起来像implementation调用此方法不会立即显示警报,而只是将其设置为当操作失败时显示警报。所以你可能必须这样做:
[UIAlertView showAlertViewForRequestOperationWithErrorOnCompletion:requestOperation
delegate:nil];
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id requestObject) {
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}];
关于ios - 应该如何使用 showAlertViewForRequestOperationWithErrorOnCompletion?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20505568/