我正在为通过Firebase设置我的应用程序的推送通知。 斯威夫特3Swift 3:参数标签'(forTypes :, categories :)'与任何可用重载不匹配
在根据didFinishLaunchingOptions的AppDelegate中,我遇到了在这条线的错误:
参数标签 '(forTypes :, :)类' 不匹配任何可用的重载
let notificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
代码:
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FIRApp.configure()
FIRDatabase.database().persistenceEnabled = true
SKCache.sharedCache.imageCache = CustomImageCache()
let notificationTypes : UIUserNotificationType = [UIUserNotificationType.alert, UIUserNotificationType.badge, UIUserNotificationType.sound]
let notificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
application.registerForRemoteNotifications()
application.registerUserNotificationSettings(notificationSettings)
谢谢!
完美的作品。谢谢! – Miles