I am trying to send the user a \'Push Notification style\' Alert when the user minimizes the app (by clicking on the iPhone\'s Home Button or by locking the phone as well).
By default NSTimer does work only in simulator. Try to add this to your AppDelegate file:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [.Sound, .Alert, .Badge], categories: nil))
application.beginBackgroundTaskWithName("showNotification", expirationHandler: nil)
return true
}