我不确定应该如何使用新的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/