我试图让我的应用程序在 Xcode 8.0工作,并运行到一个错误。我知道这个代码在早期版本的 Swift 中工作得很好,但是我假设这个代码在新版本中已经改变了。下面是我要运行的代码:
let settings = UIUserNotificationSettings(forTypes: [.Sound, .Alert, .Badge], categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
UIApplication.shared().registerForRemoteNotifications()
我得到的错误是“参数标签”(forType: ,Category:)“不匹配任何可用的重载”
还有别的命令可以让我试试吗?