Having issues testing out the custom long look notification on the apple watch simulator. The debugger log this error:
WatchKit Extension[5230:156324] Took too long to show custom notification. Falling back to static.
How to resolve this issue?
Having issues testing out the custom long look notification on the apple watch simulator. The debugger log this error:
WatchKit Extension[5230:156324] Took too long to show custom notification. Falling back to static.
How to resolve this issue?
I had exactly this problem with the default code set up by Xcode. I didn't do any operations inside didReceiveRemoteNotification, but the error still occured.
Turns out the reason it failed was that my WKUserNotificationInterfaceController subclass was not connected to the Dynamic interface Controller in my storyboard file.
Solution:
I had the same issue before.
Inside didReceiveRemoteNotification, are you calling completionHandler(WKUserNotificationInterfaceTypeCustom);
?
Also, what are you doing inside that function? If takes too much time, it will show by default the static notification:
"Use the static notification interface to define a simple version of your custom notification interface. The purpose of a static interface is to provide a fallback interface in the event that your WatchKit extension is unable to configure the dynamic interface in a timely manner"
Try giving your custom class name as NotificationController
. Xcode take it as WKUserNotificationcontroller
. It worked for me.
This will happen if you take too long in your handler to setup. If it takes too long, the watch will default to the static notification.
Be sure you are calling the correct completion block:
completionHandler(WKUserNotificationInterfaceTypeCustom);
When calling the completion handler block, if you want WatchKit to display your static interface instead, specify the WKUserNotificationInterfaceTypeDefault constant.
Reference: https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/CustomzingthePushNotificationInterface.html
In my case the problem was that the created WatchKit Extension was configured as Swift code, while my entire project was in Objective-C.
The Dynamic Interface never show up, always switching to the Static one printing the error of this post in the console. Once I changed the WatchKit Extension to Objective-C everything worked perfectly.
If you use a real watch, try turn off "Wrist Detection" in "Watch" -> "General".