Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid this error: "Took too long to show custom notification. Falling back to static."?

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?

like image 410
user1872384 Avatar asked Mar 30 '15 07:03

user1872384


3 Answers

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:

  1. Go to the storyboard file for your watchkit app.
  2. Click on your Dynamic Interface controller
  3. Click the identity inspector (middle tab in the right pane)
  4. In the Class field, select your WKUserNotificationInterfaceController subclass (xcode had named mine NotificationController)
  5. Voilà!

Make sure your WKUserNotificationInterfaceController subclass is linked to your dynamic interface controller in the Identity inspector!

like image 88
jake_hetfield Avatar answered Nov 11 '22 02:11

jake_hetfield


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"

like image 20
Javier Flores Font Avatar answered Nov 11 '22 00:11

Javier Flores Font


Try giving your custom class name as NotificationController. Xcode take it as WKUserNotificationcontroller. It worked for me.

like image 1
suji Avatar answered Nov 11 '22 02:11

suji