-2

这是我的代码:

[[AFNetworkReachabilityManager sharedManager] startMonitoring];
mainManager = [AFHTTPRequestOperationManager manager];
mainManager.requestSerializer.timeoutInterval = 30;

我像这样初始化我的 AFHTTPRequestOperationManager 。

urlToWhere = @"myurl.php";
parameters = @{@"user_id": "1"};
NSLog(@"a"); 
[mainManager POST:urlToWhere parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"result");
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@"error");
}];
NSLog(@"b");

事实是我的 a 显示在日志中,但没有显示“结果”或“错误”,然后显示 b。

AFHTTPRequestOperationManager 是否有任何例外情况?

4

1 回答 1

0

我目前无法发表评论,因此使用答案选项。你的 urlToWhere 参数不应该是这样的

urlToWhere = @"http://myurl.php";
于 2015-05-01T05:01:54.727 回答