2016-04-20 83 views
0

Im在推送通知代码表单Bluemix中存在一些问题,可以在此处找到。Swift 2:推送通知设置

https://console.ng.bluemix.net/docs/services/mobilepush/t_enable_ios_notifications_register.html

*********不知道我怎么错过了这个问题已经excisted *******

,让我,我已经写了代码中的错误是:

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 

} 

它给我的错误是:“没有 '|'候选人产生预期contexual结果类型“UIUserNotificationType”要清除它的第二个“|”这是错误的


这个问题,我还没有#2发现,虽然:。

在我后面的代码(AppDelegate中)我得到一个错误在此代码:

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) { 

它说: “应用程序“无效redeclartion(_:didRecieiveRemoteNotification:fetchCompletionHander :)”

任何想法,甚至意味着什么?

+0

不知道如何错过了一个。我在这里查了很多关于stackoverflow的问题,之前对相同问题的回答并没有帮助我。但是这个线程还有一个问题,我不知道如何回答。感谢您看到此:) – Jesper

回答

1

及其在迅速

阵列让notificationTypes:UIUserNotificationType = [UIUserNotificationType.Sound,UIUserNotificationType.Alert,UIUserNotificationType.Badge]