iOS中监听 app被杀死

//  - 添加通知的监听
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appBecomeActive) name:kApplicationDidBecomeActive object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate) name:UIApplicationWillTerminateNotification object:nil];

// - 事件处理
/** 程序进入后台的通知的事件监听 */
-(void)appEnterBackground{
    [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
}
/** 程序被杀死 */
-(void)applicationWillTerminate{
    //  - 监听到 app 被杀死时候的回调....
}



你可能感兴趣的:(iOS中监听 app被杀死)