我試過一些方法來執行NSURLConnection時鎖定屏幕,但沒有任何作品。NSUrlConnection鎖定屏幕時?
我已經試過如下:
[self performSelectorInBackground:@selector(startConnection) withObject:nil];
我也試過:
dispatch_queue_t request_queue = dispatch_queue_create("com.app.download", NULL);
dispatch_async(request_queue, ^{
[self startConnection];
});
在startConnection:
- (void)startConnection{
... some URL processing
responseData_ = [[NSMutableData alloc] init];
connection_ =
[[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
}
的NSURLConnection的委託方法不被這樣叫。 什麼是真正的代碼,使其工作?謝謝!
一個小更新,可以幫助:
它只調用此委託方法:
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
與消息:
與指定的主機服務器無法找到。
我非常肯定我的Wi-Fi連接,仍然不知道爲什麼它被稱爲:(
你是什麼意思的「睡眠模式」 – CarmeloS
當我鎖屏..我會編輯我的?帖子,似乎不明確 – Rendy