简体   繁体   中英

iOS Register for notifications in background

I need to refresh push token if user don't run app for long time. I tried to use background mode and application:performFetchWithCompletionHandler: method. Inside this method I call - registerUserNotificationSettings:(UIUserNotificationSettings )notificationSettings. And then I expect that didRegisterUserNotificationSettings (UIUserNotificationSettings )notificationSettings will be called but this not happen. Is there any way to register in APNS without running app?

Simple Answer is No

APNs can issue a new device token for a variety of reasons:

User installs your app on a new device User restores device from a backup User reinstalls the operating system Other system-defined events As a result, apps must request the device token at launch time, as described in APNs-to-Device Connection Trust and Device Tokens. For code examples, see Registering to Receive Remote Notifications.

Apple Documentation : https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM