5

I'm working with Apple Watch Notifications. I defined my own category "myAppcategory" and passed the same to notification payload. But, still i'm receiving below warning in XCode.

Warning: Notification category "(null)" not found. Define this category or a default category in your storyboard.

And result in watch simulator is below

enter image description here

Can any one help me to fix this issue?

Teja Kumar Bethina
  • 3,486
  • 26
  • 34

5 Answers5

4

I recently had the same issue. For me it was an invalid push notification payload. If you're using a .apns file (for example the sample one provided for notification controllers) to test make sure it's formatted correctly.

NRimer
  • 284
  • 1
  • 3
  • This was my issue, I forgot to add a comma in some extra keys I added to the payload. It defaulted the category name to myCategory (when that was no where mentioned as the category name). – TheCodingArt Apr 30 '15 at 16:25
3

This issue is most probably is caused after a mistaken edit that broke the formatting on the PushNotificationPayload.apns file. To resolve this issue fix the formatting in your .apns file.

The most problematic part is when you add data to alert. Make sure you add comma after each entry, except last one.

"alert": {
    "body": "Test message",
    "title": "Optional title",
    "name": "MyName"
},

Like this.

brunobowden
  • 1,492
  • 19
  • 37
Mohammad Zaid Pathan
  • 16,304
  • 7
  • 99
  • 130
  • Having tested this, I found that a trailing comma didn't cause any problem. Perhaps this is a fix in a recent version of Xcode. – brunobowden May 23 '15 at 23:46
0

Try to remove application from iphone simulator. I had the same error and I've resolved it in this way

Mediazard
  • 53
  • 4
0

Also, watch for the comma in the button list

    "WatchKit Simulator Actions": [
    {
        "title": "Stop/Save Activity",
        "identifier": "stopsave"
    },                                    // <===== THIS ONE HERE
    {
        "title": "Cancel Activity",
        "identifier": "cancel"
    }
],
0

You should add category value in your payload and define it in your storyboard.

"aps": {
    "alert": "Test message",
    "sound": "Optional title",
    "category":"myCategory"
}

reference: https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/CustomzingthePushNotificationInterface.html

JoeyJAL
  • 194
  • 1
  • 9