Search code examples
iosobjective-cxcodepush-notificationlocalnotification

iOS local notification and calendar event does not appear while app is not running


We'd like to implement silent push in our project, but facing an odd problem!

First, there's a demo project and works fine in my program environment, but after I apply the same code to my other project, the local notification does not appear after received silent push notification in AppDelegate (something magic) while the app is disconnect with xcode/in background, and there's plan B about calendar, but same as above, therefore, I have no idea to solve, any suggestion?

1. silent push notification & local notification demo project

 * xcode 10.1, deployment target iOS 10.0

 * objective-c 
 * reference tutorial: https://medium.com/@mikru168/ios-%E6%9C%AC%E5%9C%B0%E9%80%9A%E7%9F%A5-local-notification-b25229f279ec

-------> works charme. Local notification appears after receive silent push notification.

2. my project + "1."(above code)

* xcode 10.1, iOS 9.0
* objective-c mix swift 4.0

-------> works fine while debug(connect with xcode), both of while app in foreground and background.

-------> (disconnect with xcode) local notification does not appear while app in background or terminated, but works fine in foreground.

3. my project + calendar event

-------> works fine while debug(connect with xcode), both of while app in foreground and background.

-------> (disconnect with xcode) calendar notification does not appear while app in background or terminated, but works fine in foreground.


Solution

  • I would like to share with someone who's stuck this like me, here's Apple's troubleshooting, and it's really helpful: https://developer.apple.com/library/archive/technotes/tn2265/_index.html

    my finally solution is the trigger time beyond 60s.