Search code examples
crashapple-push-notificationsios10watchoswatchos-3

WatchOS 3 crash upon receiving push notification


i have an app that its configured to receive remote notifications. Before iOS 10 release everything was working fine on iOS and WatchOS side (push notification uses localised message and custom sound)

After release of iOS 10 and WatchOS 3 i had to add code that asks for push permissions using UserNotification framework (otherwise system will not provide push token, even tho old code isn't deprecated)

Worst of all if i have my watch app running when remote notification arrives - watches will reboot with apple logo. So push notification isn't crashing app itself, it crashes whole watch OS. Any ideas?


Solution

  • Found a problem. Following payload causes Apple Watch to reboot

    {
    aps =     {
        alert =         {
            "loc-args" =             (
                Test,
                "<null>",
                Test,
                4147
            );
            "loc-key" = "test";
        };
        category = "test";
        sound = default;
    };
    }
    

    If i replace "<null>" with " " - crash will go away