2 Replies
      Latest reply on Dec 20, 2016 11:10 PM by Aneesh Kumar P
      Aneesh Kumar P Level 1 Level 1 (0 points)



        I have a application built on iOS 9.3. When i install ipa file of this app in iOS 10 devices local notification are not showing. Is this beacuse of deprecation of UILocalNotification API in iOS 10, but how it will impact on local notification if i build against iOS 9.3 ?



        Aneesh Kumar P

        • Re: LocalNotification not working in iOS 10
          eskimo Apple Staff Apple Staff (13,325 points)

          Is this beacuse of deprecation of UILocalNotification API in iOS 10 …

          That’s very unlikely.  UILocalNotification has been deprecated but it still works.  I tried this here in my office with a small test app.  Here’s the code I used to post the notification:

          let t = UIApplication.shared.beginBackgroundTask(expirationHandler: nil)
          Timer.scheduledTimer(withTimeInterval: 5.0, repeats: false) { _ in
              let note = UILocalNotification()
              note.alertBody = "Hello Cruel World!"

          And don’t forget you have to register for permission to post notifications:

          let settings = UIUserNotificationSettings(types: [.alert], categories: nil)

          After setting the deployment target to iOS 10 I get lots of deprecation warnings when building the app, but the app functions just fine (built with Xcode 8.2, running on iOS 10.1.1).

          IMPORTANT The code above was part of a quick hack; it is not intended to be production quality.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"