WatchOS 3 crash upon receiving push notification - crash

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?

Have you checked your app capabilities and certificates are all OK?
I have a similar setup for one of my apps (using remote notifications), and I haven't needed to update the notification registration code to use the new UserNotification framework - it works as before on iOS10.
Xcode 8 is slightly different in how it tries to help manage your certificates and maybe something got messed up?

I was having the same issue, and the thing causing crash was "url" value of user info being null. I asked my back-end dev to make it just empty string and everything worked

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

Related

WatchOS app keeps crashing when being opened from remote notification

WatchOS app works normally if being opened from home screen. If I try to open it from remote notification screen (by tapping title label) two app behaviors can be spotted:
If application was loaded previously (I don't know how to name it, maybe better to tell that app is not killed by system or still present in memory). In this case application will load normally and do some action if asked (for example open some Interface Controller and show remote notification details).
If application was launched long time ago (or killed by system, unloaded from memory, in my case I'm stopping it in Xcode). If app receives remote notification in this state after tapping on title label of notification scene it will try to load for some time and finally crash (this may take 1sec or 1min). Or it will stuck with loading indicator shown - what is interesting that in this case if I'll try to attach watch extension process to Xcode debug it will show that app is launched and works (for example I can send some data from parent iOS app and watchOS app will receive it - triggered method in Extension delegate and do some stuff).
Googling I have found that watch apps can be killed by system if they take to much power when being launched, so I tried to remove any load while app is starting itself but with no success - it still keeps crashing.
The only close to mine situation that I've found so far was a topic in apple developers forum:
https://forums.developer.apple.com/thread/20553
I have been spotting the same logs like in topic when watching how watch app behave in Xcode/Devices, but after updating to WatchOS 3 (now 3.1 beta) and using new Xcode 8 (now 8.1 beta) I can't see any logs from WatchOS at all (just some system messages that watch screen was turned of and on).
Have any one spotted such issues while working with watchOS remote notifications? Any suggestion where to search for solution?

Can an iBeacon notify a user's iphone without an app being installed?

I'm new to iBeacon's and am trying to understand one simple thing.
Can I use iBeacon to display a notification on a user's iphone without a custom app being installed?
For example, I'd like to build an app that sends out iBeacon messages to people that have an iPhone. When they get near an iPad running my app, it notifies them that they're near my "event", which of course is taking place at the location of my iPad.
Is this possible without the user having already installed another app that I've made to receive notifications of my event?
Note that I'm open to any other tech or ideas that would make this work. I know that Apple does this with their Apple Stores, but I'm guessing they can do this because they already have an app installed on the users device - probably the "AppStore" app.
You typically need an app for any iOS notifications on seeing an iBeacon. That is what Apple does for their stores.
The only exception is if you use Passbook to set up a notification trigger. But you still need the user to install your Passbook entry.

iOS 7 Silent Push Notification doesn't work in background when application not connected to the xcode

iOS 7 Silent Push Notification doesn't work in background when application not connected to the xcode.
I used following payload and when application is in background/foreground/background & connected to the xcode, control comes in application:didReceiveRemoteNotification:fetchCompletionHandler method
but when application is in background and not connected to the xcode this method never gets called.
The payload used:
{ "content-available": 1, "sound": ""}
Seems like the payload is incorrect. It needs to children to the "aps" key.
You need to check what running state your application is in. Apple isn't clear about it but the app needs to already be in the multi task screen before silent push works.
Source (my own post, we have deployed this)
http://heywiretech.tumblr.com/post/67471006073/multitasking-in-ios7
Is your app have permissions to present notifications? If no this can lead to silent fail, so add logging and check again.
Don't forget to turn the Background Modes on in the target's Capabilities.

iOS6: iPhone app getting restarted on receiving any type of notification in device

While testing our iPhone app in devices with iOS 6 beta 4, we found an issue wherein if any notification like reminder alert is received or when we pull down the notification curtain, the application is restarting from beginning.
It never used to happen like this till iOS 5.X. Apple release notes or known issues of iOS 6 beta did not mention anything regarding this.
Did anyone faced this issue?
Any comments on whats going wrong?
Check in the app's .plist file to see if application somehow got set not to run in the background.

iOS: how to register for push notifications?

I'm trying to implement Push Notifications for my iOS 5 application by the guide from Ray Wenderlich: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12.
I've inserted the following into my didFinishLaunchingWithOptions method in my AppDelegate:
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
When running the application on my device (not simulator) the popup/alert telling me to accept push notifications isn't displayed. I've inserted a debug-point on the line, and I can see, that the registerForRemoteNotificationTypes is called.
Why is nothing happening?
Maybe, delete your app and try again. That dialog only appears once. But I'm not sure that whether that dialog will appear again when you reinstall that app.
You can also go to your setting app the notification center, see if your app is on the list.
You can also add a break point and see if didRegisterForRemoteNotificationsWithDeviceToken executes.
I had this exact issue (with the same tutorial no less), and found that I was signing the code with the wrong provisioning profile.
Specifically, I only enabled "Production" push notifications for my app (since I didn't want to make certificates twice etc) but my Build Settings in Xcode used "iPhone Development" as the default "Code Signing Identity" for "Release", rather than "iPhone Distribution" as it should have been. This seemed to be the default setting in my test app.
Hopefully I can stop someone else wasting time on the same problem.
From iOS 8 there's new method for this. Straight from UIApplication.h:
- (void)registerForRemoteNotifications NS_AVAILABLE_IOS(8_0);
Calling this will result in either application:didRegisterForRemoteNotificationsWithDeviceToken: or application:didFailToRegisterForRemoteNotificationsWithError: to be called on the application delegate.
Note: these callbacks will be made only if the application has successfully registered for user notifications with registerUserNotificationSettings:, or if it is enabled for Background App Refresh.