【发布时间】:2016-04-20 07:53:06
【问题描述】:
我在使用 Bluemix 的推送通知代码时遇到了一些问题,可以在此处找到。
https://console.ng.bluemix.net/docs/services/mobilepush/t_enable_ios_notifications_register.html
*********不知道我怎么错过了这个问题已经被取消了*******
我写的给我错误的代码是:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let notificationTypes: UIUserNotificationType = UIUserNotificationType.Badge | UIUserNotificationType.Alert | UIUserNotificationType.Sound
let notificationSettings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
application.registerUserNotificationSettings(notificationSettings)
application.registerForRemoteNotifications()
return true
}
它给我的错误是:“No '|'候选人产生预期的上下文结果类型'UIUserNotificationType'。清除它的第二个“|”是错误的。
我在 Stackoverflow 上没有找到这个问题:
稍后在我的代码(Appdelegate)中,我在此代码中遇到错误:
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
它说:“'application(_:didRecieiveRemoteNotification:fetchCompletionHander:) 的重新声明无效”
你知道这意味着什么吗?
【问题讨论】:
-
不知道我怎么错过了那个。我在stackoverflow上检查了很多,之前对相同问题的答案对我没有帮助。但是在这个帖子中还有一个问题我不知道如何回答。谢谢你看到这个:)
标签: swift push-notification ibm-cloud