多个用户使用同一设备时处理Apple推送通知的最佳做法

Mar*_*ary 11 apple-push-notifications ios

我的应用是用户特定的.多个用户可以使用同一个设备.我的应用程序具有脱机注销功能.考虑我的一个用户(比如用户1)注销offline.during那时我的服务器向APNS发送user1的通知.一段时间后我的设备上线了.在那段时间我没有登录到应用程序.我的问题是,当我的设备在线时(当网络连接可用时)并且user1被注销,我的应用程序将收到来自APNS服务器的推送通知(那些为已注销用户发送的通知)

tha*_*rem 13

注销时: [[UIApplication sharedApplication] unregisterForRemoteNotifications];

登录时:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
        (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
Run Code Online (Sandbox Code Playgroud)