【发布时间】:2012-10-06 07:16:09
【问题描述】:
我在applicationDidEnterBackground 中调用了一个api,但是applicationDidEnterBackground 方法在5 秒后返回,所以我怎么能增加计时器或者在api 完成之后只有applicationDidEnterBackground 会返回我们所有人建议使用beginBackgroundTaskWithExpirationHandler
但是我不知道怎么用,谁能指导我?
这是我的代码
- (void)applicationDidEnterBackground:(UIApplication *)application
{
NSString *link=[NSString stringWithFormat:@"http://www.askpundit.com/dev/js_chat/getNewRequest.php?updateStatus=%@&clientid=%@",UpdateStatus,[self getSetting:@"Clientid"]];
NSURLRequest *request=[[NSURLRequest alloc]initWithURL:[NSURL URLWithString:link]];
NSURLConnection *connaction=[[NSURLConnection alloc] initWithRequest:request delegate:self];
if (connaction)
{
responsedata=[NSMutableData data];
NSLog( @"Data Saved");
}
}
谁能指导我在通话结束后如何返回applicationDidEnterBackground。
【问题讨论】:
标签: iphone objective-c uiapplicationdelegate appdelegate