I have read the documentation and I understand that using Handoff I can exchange data between a specific website and app.
I have a curated list of items from various RSS feeds, all having links pointing to different websites. I would like to give the user the ability to open the link for an item (like a "More" button) in Safari on their mac instead of Safari on their iPhone.
Since all the links would be from different domains, certificates don't really apply. Is it possible to open Safari on a mac with a specific URL from an iOS app using Handoff? I couldn't really understand from the documentation if this was a possibility or not.
Third-party apps with Handoff functionality include Airbnb, NY Times, The Wall Street Journal, Wunderlist, iA Writer Pro, Quip, Camera Plus and more.
Here's how to turn on Handoff: Mac: Choose Apple menu > System Preferences, then click General. Select “Allow Handoff between this Mac and your iCloud devices.” iPhone, iPad, or iPod touch: Go to Settings > General > AirPlay & Handoff, then turn on Handoff.
With Handoff, you can start something on one device (iPhone, iPad, iPod touch, Mac, or Apple Watch) and then pick it up on another device right where you left off. For example, you can start answering an email on your iPhone, then finish it in Mail on your Mac.
Create an NSUserActivity object and specify the webPageURL property. Use an activityType specific to your app. If there is no app on the mac which supports that particular activityType, then Safari will pick it up.
NSUserActivity* myActivity = [[NSUserActivity alloc]
initWithActivityType: @"com.company.acme.myapp"];
myActivity.webpageURL = [NSURL URLWithString:@"http://www.google.co.uk"];
As per the docs for NSUSerActivity.webPageURL:
When no suitable application is installed on a resuming device and the webpageURL property is set, the specified webpage is loaded and the user activity is continued in a web browser.
Both flows (app-to-browser and browser-to-app) are documented at https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/Handoff/AdoptingHandoff/AdoptingHandoff.html
Your question comes under "Native App-to-Web Browser Handoff".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With