Различные фоновые режимы в iOS
Чтобы распознать, что мое приложение вошло в фоновый режим [одним коротким нажатием кнопки Home], я использую эту функцию:
func applicationDidEnterBackground(_ application: UIApplication) {
//...
}
Но как я могу распознать, что мое приложение вошло в режим переключения приложений [два коротких нажатия кнопки "Домой"]? Метод applicationDidEnterBackground
не называется в этом случае.
1 ответ
Решение
Попробуй это:
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}