cancelAllLocalNotifications in applicationWillTerminate?

前端 未结 2 1431
温柔的废话
温柔的废话 2021-01-14 20:36

I want to cancelAllLocalNotifications and setApplicationIconBadgeNumber to 0 when my application is terminated (either by the OS or by double tapping the home button and kil

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 21:14

    You should use applicationWillResignActive: instead.

    Starting with iOS 4.0 applicationWillTerminate is not called for applications when they are killed in the background. Apps are put in the background when you hit the home button now or otherwise switch apps.

提交回复
热议问题