2015-09-02 26 views
1

我正在爲iOS 9beta開發推送通知應用程序 - 使用xcode 7 beta 6觀看OS 2 beta ...我已經完成了蘋果文檔中提到的所有設置,但我收到了推送通知只有在我的iPhone應用程序,而不是在手錶..即使當我的iPhone應用程序沒有在前臺運行,我仍然收到iPhone的嘟嘟聲,但沒有看到.. 這是服務器推送的有效載荷結構:Apple Watch OS2上的推送通知問題

{ 
    "aps": { 
     "alert": { 
      "body": 「Notification Body", 
      "title": 「Notification Title" 
     }, 
     "category": "MessageCategory", 
     "badge" : 1, 
     "sound" : "default" 
    }, 
    "WatchKit Simulator Actions": [ 
            { 
            "title": "View", 
            "identifier": "ViewAction" 
            } 
            ], 
    "callVolume": { 
     "BU 1": 25, 
     "BU 2": 30, 
     "BU 3": 45, 
     "BU 4": 50, 
     "BU 5": 60 
    } 
} 

我可以運行「通知 - WatchApp」目標,看到了動態界面加載 但收到推送通知時,覆蓋FUNC didReceiveRemoteNotification(remoteNotification:[ NSObject:AnyObject],withCompletion completionHandler:((WKUserNotificationInterfaceType) - > Void))不會被觸發。

我錯過了什麼? 在此先感謝。

回答

0

我找到了我的問題的答案。這是我使用的有效負載結構。

{ 「APS」:{

"alert": { 
     "title": "Some message title", 

     "body": "Some message body" 
    }, 

    "category": "MyCategory", 

    "badge": 1, 

    "sound": "default" 

}, 

"callVolume": { 

    "BU1": 25, 

    "BU2": 45, 

    "BU3": 100, 

    "BU4": 35, 

    "BU5": 60 
} 

}

按鈕標題是基於我們對UIUserNotificationSettings註冊UIMutableUserNotificationAction標題顯示。