Reputation: 1059
I just had my IOS (8.2) app update rejected because local notification were not appearing on the Apple Watch.
Since local notifications cannot be tested on the simulator, and the watch hasn't been released yet, it's a bit difficult to tell exactly what is wrong.
I suspect it has to do with setting the alertTitle property of the UILocalNotification object, as mentioned in the Apple Watch Programming Guide which I wasn't doing.
The reason I wasn't setting this is because the alertTitle and alertBody properties seem to be treated differently in Notification Centre and the Watch.
For example, if I want the Watch to show "History in 2 minutes.", then according to the programming guide, I need to set the alertTitle.
However, for the iPhone app, I need to set the alertBody so that Notification Alerts display as shown (If I only set title, and no alertBody, then the notification alert is not shown):
Text from alertBody:
But, if I also set the alertTitle to the same text, (so that it appear on the Watch) then in Notification centre, the text is shown twice, i.e. the title and the body, e.g.:
Text from alertTitle and alertBody
Also, if I don't set the alertTitle, then the main notification screen shows the app name, which is rather annoying too. e,g,:
Text from app name and alertBody - no alertTitle set:
So, is there any combination of setting alertTitle and alertBody that will work for Notification Alerts, Notification Centre and the Watch?
BTW: I've just removed the notification screen shots and description from the app and re-submitted. I'll add local notifications back once I can test in the simulator (If that ever happens), or I get a watch (if that ever happens too!).
Upvotes: 3
Views: 1482
Reputation: 23078
It makes sense when setting the alert title and the alert body to different texts. According to the Apple docs for the alert title of UILocalNotification:
Title strings should be short, usually only a couple of words describing the reason for the notification. Apple Watch displays the title string as part of the short look notification interface, which has limited space.
So, in my app I set the title and the body to different texts.
This appears when the notification pops up:
And this is the text in the notification center, where both the title and the body are displayed:
I understand the docs so that only the title will be displayed in the short notificaton on the Apple Watch.
I think your app got rejected due to not setting a title for the notification.
Upvotes: 4