Ios AFHTTPRequestOperationManager不是';t呼叫(无响应/无故障)
这是我的密码:Ios AFHTTPRequestOperationManager不是';t呼叫(无响应/无故障),ios,objective-c,afnetworking,afhttprequestoperation,Ios,Objective C,Afnetworking,Afhttprequestoperation,这是我的密码: [[AFNetworkReachabilityManager sharedManager] startMonitoring]; mainManager = [AFHTTPRequestOperationManager manager]; mainManager.requestSerializer.timeoutInterval = 30; 我像这样初始化我的AFHTTPRequestOperationManager urlToWhere = @"myurl.php"; para
[[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是dodge时是否有任何例外情况?我现在无法评论,因此请使用回答选项。您的urlToWhere参数不应该是这样的吗
urlToWhere = @"http://myurl.php";
Result and Error仅在收到响应或发生错误后调用。你预计反应会有多大?POST方法是后台线程中的一个块,不会立即显示。我希望我的代码在继续之前等待答案,因此我使用了
dispatch\u semaphore\u t semaphore=dispatch\u semaphore\u create(0);mainManager.completionQueue=dispatch\u get\u global\u queue(dispatch\u queue\u PRIORITY\u默认值为0)代码>在它前面,和调度信号灯\等待(信号灯,调度时间\永远)代码>在末尾。仍然不起作用urlToWhere
不是有效的URL。这就是为什么这不起作用。