Iphone applicationWillResignActive时未调用对委托的调用
我有一个应用程序与一些视图控制器推。我在JSON Web服务上登录,在应用程序处于活动状态时获取一些数据并执行一些工作。当应用程序关闭或移动到后台时,我想注销 通常情况下,我的JSON加载器在自己的线程上调用webservice,并使用NSDictionary和表示调用结果的枚举调用委托 使用以下函数将应用程序发送到后台时,我将错过此调用:Iphone applicationWillResignActive时未调用对委托的调用,iphone,objective-c,delegates,invocation,Iphone,Objective C,Delegates,Invocation,我有一个应用程序与一些视图控制器推。我在JSON Web服务上登录,在应用程序处于活动状态时获取一些数据并执行一些工作。当应用程序关闭或移动到后台时,我想注销 通常情况下,我的JSON加载器在自己的线程上调用webservice,并使用NSDictionary和表示调用结果的枚举调用委托 使用以下函数将应用程序发送到后台时,我将错过此调用: - (void)applicationWillResignActive:(UIApplication *)application { JSONLoa
- (void)applicationWillResignActive:(UIApplication *)application
{
JSONLoader *json = self.startViewController.json;
NSString *usr_no = [self.startViewController.user.usr_no stringValue];
//ask json for logoff
NSString *relativePath = [NSString stringWithFormat:@"users/%@?action=logout", usr_no];
NSURL *logoutUrl = [NSURL URLWithString:relativePath relativeToURL:kBaseURLString];
[json loadWithURL:logoutUrl sendResult:kJSONLogoutSuccess];
}
它进行注销,但从未到达代表处的程序,我必须确保注销成功:
-(void)updatedDictionaryFromJson:(NSDictionary *)items withResult:(JsonResult)result{
// do some other stuff..
if (result == kJSONLogoutSuccess) {
//user logout was successful
NSLog(@"got some logout json");
}
}
为什么应用程序在后台运行时没有调用调用,有人有过类似的经验吗?应用程序已经在后台了吗?还是我应该辞职?有什么建议吗