如何显示“想要向您发送推送通知";再次警报视图? [英] How to show "Would like to send you Push Notifications" Alert View again?

查看:21
本文介绍了如何显示“想要向您发送推送通知";再次警报视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在注册远程通知后,我能够显示如上图所示的警报视图.但是当我删除我的项目应用程序并重新构建它时,它将不再显示.

I was able to show an Alert View like the image above after registering for Remote Notifications. But when i delete my Project App and build it again, it will not show anymore.

是否有机会再次向同一设备显示警报视图?

Will there be any chances to show the alert view again to the same device?

我喜欢再次获取我的设备令牌,因为我未能将设备令牌临时存储在 NSUserDefaults 中.

What i like is to get my device token again because I failed to store the device token temporarily in the NSUserDefaults.

推荐答案

在启动时,您的应用应该通过以下方式请求令牌:

At launch, your app should be requesting a token via:

- (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types

并且将在委托消息中从 iOS 获取令牌:

and will get a token from iOS in the delegate message:

– application:didRegisterForRemoteNotificationsWithDeviceToken:

iOS 只会在必要时提示用户允许通知.如果已为您的应用授权远程通知,则不会出现警报,您的应用将获得有效令牌.

iOS will prompt the user to allow notifications only when necessary. If remote notifications are already authorized for your app the alert will not appear and your app will get a valid token.

Net 是您不能强制发出警报,但您不需要这样做.

Net is you can't force the alert but you don't need to.

这篇关于如何显示“想要向您发送推送通知";再次警报视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆