สำคัญต้องรู้เมื่อผู้ใช้กด Home (แอปไป Background) ใช้ Delegate Methods ใน AppDelegate
ใน AppDelegate.swift ใส่ print และ breakpoint ใน:
applicationWillResignActive(_:)applicationDidEnterBackground(_:)

รันแอป กด Home → applicationWillResignActive ถูกเรียกก่อน ตามด้วย applicationDidEnterBackground