This is a proof of concept for sending interactive notifications
-
Add an array of activity types in the Info.plist, one for each type of hand-off (key = NSUserActivityTypes)
-
Create an NSUserActivity object with the activity type (in this case I have used com.adhoc.CoreDataSample.browsing)
-
Set the webpageURL of the NSUserActivity to the web page which needs to be opened
-
Assign the activity type to the ViewController's userActivity
-
If needed, handle the event when the hand-off happens
To test
-
Enable Hand-offs on a device and a mac (for Mac you will find it in System Preferences->General. On phone you will find it in Settings->General)
-
Turn on Bluetooth on both the Mac and iPhone as well as sign in to the same iCloud account on both devices
-
Run the app on the device. Tap on a row
-
An icon of your default browser will show up on the mac with a phone symbol. Tap on it
-
This will open the web url associated with the row (as mentioned in the feed) on the web browser