registerUserNotificationSettings
全部标签 我有很多用户提示说,当他们从iOS10.3.3迁移到昨天发布的iOS11时,他们停止接收静默推送通知。需要注意的是,如果我已经要求用户注册推送通知,我在NSUSerDefaults中有一个设置。我这样做:[[UIApplicationsharedApplication]registerUserNotificationSettings:settings];仅当用户之前没有被询问过。现在,如果用户在使用iOS10.3.3时已经注册了通知,并升级到iOS11,代码registerUserNotificationSettings:settings将永远不会被调用,直到他重新安装。这可能是个问题
问题isRegisteredForRemoteNotifications即使我已成功收到设备token,也返回false。情况1。注册在用户安装我的应用程序后,在特定时间点,我会检查isRegisteredForRemoteNotifications,如果为false,我会使用上面的代码请求用户允许通知funcregisterUserNotificationSettings(){letuserNotificationTypes:UIUserNotificationType=([.alert,.badge,.sound])letsettings=UIUserNotificationSet
当我在文档中找到它时,我正打算使用iOS8的新远程通知API:"Itisrecommendedthatyoucallthismethodbeforeyouscheduleanylocalnotificationsorregisterwiththepushnotificationservice"我不明白为什么这么说。我的印象是这两个方法调用:registerUserNotificationSettings和registerForRemoteNotifications现在是独立的,一个不影响另一个。那为什么建议先调用一个呢? 最佳答案
docsforregisterUserNotificationSettings:状态:Ifyourappdisplaysalerts,playsounds,orbadgesitsicon,youmustcallthismethodduringyourlaunchcycletorequestpermissiontoalerttheuserintheseways.我很失望地读到这篇文章,因为应用程序在需要之前请求发送推送通知的许可似乎很粗鲁。例如,在我正在设计的应用程序中,用户必须在有任何理由发送推送通知之前使用我们的在线服务创建一个帐户。并且可能用户从未注册,只是在本地使用该应用程序,因
我已经使用Swift和Xcode6以及用于处理服务的Parse框架为iPhone构建了一个应用程序。在按照有关如何设置推送通知的Parse教程进行操作时,说明建议我将推送通知放在AppDelegate文件中。这是我添加到AppDelegate文件中的代码...@UIApplicationMainclassAppDelegate:UIResponder,UIApplicationDelegate{varwindow:UIWindow?varpushNotificationsController:PushNotificationController?funcapplication(appl
我已经使用Swift和Xcode6以及用于处理服务的Parse框架为iPhone构建了一个应用程序。在按照有关如何设置推送通知的Parse教程进行操作时,说明建议我将推送通知放在AppDelegate文件中。这是我添加到AppDelegate文件中的代码...@UIApplicationMainclassAppDelegate:UIResponder,UIApplicationDelegate{varwindow:UIWindow?varpushNotificationsController:PushNotificationController?funcapplication(appl
除了去年11月生成的文档(here),我似乎找不到任何关于registerUserNotificationSettings的文档,但我的旧代码似乎不再适用于Xcode7和Swift2。我在AppDelegate中有这段代码:letendGameAction=UIMutableUserNotificationAction()endGameAction.identifier="END_GAME"endGameAction.title="EndGame"endGameAction.activationMode=.BackgroundendGameAction.authenticationRe
除了去年11月生成的文档(here),我似乎找不到任何关于registerUserNotificationSettings的文档,但我的旧代码似乎不再适用于Xcode7和Swift2。我在AppDelegate中有这段代码:letendGameAction=UIMutableUserNotificationAction()endGameAction.identifier="END_GAME"endGameAction.title="EndGame"endGameAction.activationMode=.BackgroundendGameAction.authenticationRe
我似乎无法在iOS8.1或8.2中收到显示registerUserNotificationSettings的提示。这是我在didFinishLaunchingWithOptions中所做的:if([applicationrespondsToSelector:@selector(registerUserNotificationSettings:)]){#ifdef__IPHONE_8_0UIUserNotificationSettings*settings=[UIUserNotificationSettingssettingsForTypes:(UIUserNotificationTyp