Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't handoff from Mac to iOS, even though handoff from iOS to Mac works fine

I'm trying to implement Handoff between a Mac OS app and an iOS app. It works fine when the iOS app is in the foreground -- the "Continue Activity" icon shows up in the dock on the Mac. However I can't get the "Continue Activity" icon to show up on the lock screen of the iOS device when the Mac app is in the foreground.

Both apps are signed with the same team credentials. Both devices are signed into the same iCloud account (verified via iCloud.com) and have Bluetooth turned on. Handoff from a Mac app such as Safari to the iOS device works fine. And handoff works fine between two iOS devices running the app. Any ideas?

like image 746
Trevor Alyn Avatar asked Oct 29 '22 23:10

Trevor Alyn


1 Answers

I reported a bug report to Apple, and Apple told me that my iOS app's info.plist doesn't declare NSUserActivityTypes at all, and my Mac app's info.plist correctly declares NSUserActivityTypes, resulting in handoff only working from iOS to Mac and never Mac to iOS.

This issue is due to the iOS version of the app not claiming the activity type in the info.plist, resulting in the iOS device not knowing what app to give the handoff to.

In my Xcode project in the left navigation panel, I opened info.plist and NSUserActivityTypes was indeed there already. But I then realized that there are multiple info.plist files in my project when I search it using Finder in the project folder. Then I physically went into my project folder with Finder and tried to locate this info.plist file, but when I located one inside projectName/projectName it opened a different info.plist file that I couldn't initially access via Xcode project navigator. The different info.plist file did not have NSUserActivityTypes, and so I added it, and woala~ handoff finally worked from Mac to iOS! It is very odd there were fake multiple info.plist in my project. My real info plist was hidden from Xcode...

like image 190
coolcool1994 Avatar answered Nov 13 '22 02:11

coolcool1994