iphone - 应用程序处于“睡眠”状态的时间

时间:2012-01-27 15:17:12

标签: objective-c background sleep

Helo家伙,

我有一个奇怪的问题。 我的应用程序在后台无休止地工作,因为它是一个位置应用程序(是基于位置的应用程序可以无休止地运行)。

事情是“有时”在一段时间后(数量为5,10或36小时)它在后台崩溃时会发生以下消息:

identifier: UIKitBackgroundCompletionTask process: MyApp[7149] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:7149 preventSuspend  preventIdleSleep 

我一直在检查这个,我找不到直接的答案。因为它在那10分钟之后没有崩溃,但是“每当它感觉像”我认为它可能与我睡眠应用程序的方式有关。 如果我按回家,它会转到后台,但是如果我按下“睡眠/唤醒”按钮它处于另一个状态,睡眠模式,该状态是否会使我的应用程序最终在一段时间后崩溃?

感谢。

[编辑] 显然,这与NSURLConnection在10.5.7下崩溃的问题类似 但由于这是一个iPhone应用程序,我认为这不是我的问题。我也没有使用这些方法进行连接,也许你可以帮助我,这些是我在后台模式下用来连接我的webservice的方法:

NSURL *url = [NSURL URLWithString: @"http://mywebservice.com?wsdl"];//to create the url
[NSURLConnection connectionWithRequest:req delegate:self];//sending the request

NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30];
// and then to address the answer of the server
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response 
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
-(void)connectionDidFinishLoading:(NSURLConnection *)connection

0 个答案:

没有答案