How to debug iOS Handoff?

720 views Asked by At

I've added a small amount of code to my app which supposed to handle Handoff. Nothing fancy, just creating simple NSUserActivity, setting my -[UIViewController userActivity] property to it and make it current. And I did added proper NSUserActivityTypes array to my Info.plist, but still nothing works. My both devices logged in to the same iCloud account, and Safari Handoff works perfectly. I tried everything: my app icon does not appears on the other device lock screen. No errors, no warning, no nothing. How can I debug it?

1

There are 1 answers

0
Alexander Vasenin On BEST ANSWER

If nothing helps, try to see for suspicious messages in both of your devices console. In Xcode menu choose Window -> Devices, select one of your devices and look for anything related to Handoff.

In my case what I found was:

 Jan 27 13:24:40 my-iphone useractivityd[1176] <Warning>: <NSXPCConnection: 0x145566b0> connection from pid 2012: Warning: Exception caught during decoding of received message, dropping incoming message.
 Exception: decodeObjectForKey: class "UniversalLink" not loaded or does not exist

So my problem was: I was setting -[NSUserActivity webpageURL] to my custom subclass of NSURL named UniversalLink. I've changed it to pure NSURL and it worked perfectly ever since. Hope this help someone!