ios - "WatchKit Simulator Actions" not working on actual apple watch device -


i've tested simulated apple watch push notification , works fine...

however when tried send actual apple watch, button doesn't appear... why so?

and doesn't vibrate or beep when send push notification in json format instead of text...

{      "aps": {          "alert": {              "body": "great!\nnew input",              "title": "optional title"          },          "category": "scategory"      },            "watchkit simulator actions": [                                     {                                     "title": "details",                                     "identifier": "sdetailsbuttonaction"                                     }                                     ],            "customkey": "use file define testing payload notifications. aps dictionary specifies category, alert text , title. watchkit simulator actions array can provide info 1 or more action buttons in addition standard dismiss button. other top level keys custom payload. if have multiple such json files in project, you'll able select them when choosing debug notification interface of watch app."  }

enter image description here

have @ this.

to specify custom action buttons, need create custom notification category. when create notification, set category customized one.

the example apple documentation:

func registersettingsandcategories() {     var categories = nsmutableset()      var acceptaction = uimutableusernotificationaction()     acceptaction.title = nslocalizedstring("accept", comment: "accept invitation")     acceptaction.identifier = "accept"     acceptaction.activationmode = uiusernotificationactivationmode.background     acceptaction.authenticationrequired = false      var declineaction = uimutableusernotificationaction()     declineaction.title = nslocalizedstring("decline", comment: "decline invitation")     declineaction.identifier = "decline"     declineaction.activationmode = uiusernotificationactivationmode.background     declineaction.authenticationrequired = false      var invitecategory = uimutableusernotificationcategory()      invitecategory.setactions([acceptaction, declineaction], forcontext: uiusernotificationactioncontext.default)     invitecategory.identifier = "invitation"     categories.addobject(invitecategory)  // configure other actions , categories , add them set...      var settings = uiusernotificationsettings(fortypes: [.alert, .badge, .sound], categories: categories)      uiapplication.sharedapplication().registerusernotificationsettings(settings) } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -