相关疑难解决方法(0)

在Xcode 8/Swift 3.0中注册推送通知?

我正在尝试让我的应用程序在Xcode 8.0中运行,并且遇到了错误.我知道这个代码在以前版本的swift中运行良好,但我假设在新版本中更改了代码.这是我正在尝试运行的代码:

let settings = UIUserNotificationSettings(forTypes: [.Sound, .Alert, .Badge], categories: nil)     
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
UIApplication.shared().registerForRemoteNotifications()
Run Code Online (Sandbox Code Playgroud)

我得到的错误是"参数标签"(forTypes:,categories :)'与任何可用的重载都不匹配"

是否有一个不同的命令,我可以尝试使其工作?

push-notification ios swift3 ios10 unusernotificationcenter

116
推荐指数
7
解决办法
10万
查看次数

CloudKit CKSubscription没有通知?

我正在使用CloudKit编写Swift应用程序.当设备在CloudKit中修改记录时,我希望在其他设备的本地存储中更新相应的记录,而不显示推送通知.

我需要调用registerUserNotificationSettingsdidFinishLaunchingWithOptions(这意味着用户必须接受我的应用程序的通知),即使我不打算显示任何推送通知?

application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: .Alert, categories: nil))
Run Code Online (Sandbox Code Playgroud)

ios swift cloudkit

10
推荐指数
2
解决办法
1215
查看次数