Local Notification question

Home Forums Swift and Sprite Kit Local Notification question

Tagged: 

This topic contains 0 replies, has 1 voice, and was last updated by  Andrew Jarrell 3 months, 1 week ago.

  • June 21, 2016 at 1:47 pm #151925

    So, I’ve got the following local notification in my game…

    let localNotification:UILocalNotification = UILocalNotification()
        localNotification.alertAction = "Battle"
        localNotification.alertBody = "You've encountered a battle!"
        localNotification.fireDate = NSDate(timeIntervalSinceNow: 60)
        UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
    

    What I’d like to do is change a BOOL value to true when this notification fires. So after 60 seconds the notification happens and at that moment a BOOL goes from false to true.

    I want this to happen regardless of whether the user has even read the notification.

    To give a bit of context the notification is to notify the user that they’ve encountered a battle and I want the battle screen to pop up the next time they open the app regardless of whether they open the app using the notification or just by tapping the icon the traditional way. I can do this if I can just figure out how to toggle the BOOL value at the same time the notification goes off.

    Any ideas?

You must be logged in to reply to this topic.