我有以下代码向我的 api 发出请求:
-(void)makeApiCall:(NSString *)function params:(NSDictionary *)params notificationName:(NSString *)notificationName
{
NSURL *url = [NSURL URLWithString:kBaseUrl];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
httpClient.parameterEncoding = AFFormURLParameterEncoding;
NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:[NSString stringWithFormat:@"%@/%@",kApiBaseUrl,function] parameters:params];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
NSLog(@"complete");
//..My code
}];
}
我的问题是,在 NSLog(@"complete") 之后,应用程序被冻结了 5 秒。我该如何解决这个问题?
谢谢。