Questions tagged [nsuseractivity]

An NSUserActivity object provides a lightweight way to capture app state so that it can be restored later. NSUserActivity supports activity restoration from Handoff, which lets users begin an activity on one device and continue it on another, and from search results.

Using Handoff, for example, a user who is editing a document on a Mac can continue editing that document on an iPhone. A person watching a movie on an iPad can continue watching on a Mac. In both cases, the users resume the activity at the point at which they stopped on the original device. Your apps should work to make this experience as seamless as possible. In iOS 9 and later, an NSUserActivity object can be indexed and made available to users in search results when they perform on-device searches in Spotlight. To ensure that users get rich search results, you can provide metadata that fully describes the activity. When users select your activity from a list of search results, the system passes that activity and result to your app as it is launched, so that you can restore app state appropriately.

91 questions
14
votes
1 answer

Using Handoff with Watchkit to bring the iPhone app to the foreground

I have a simple project where the user taps a button on the Apple Watch and some audio plays on the iPhone, this is easy enough to do with the openParentApplication method and having the handleWatchKitExtensionRequest code in AppDelegate. However,…
ZhouW
  • 1,187
  • 3
  • 16
  • 39
12
votes
4 answers

Make App Activities and States Searchable by using NSUserActivity

Following is the code that I am trying to implement to make app activities and states searchable but not able to show on iOS search NSUserActivity *userActivity = [[NSUserActivity…
Ayush
  • 3,989
  • 1
  • 26
  • 34
11
votes
1 answer

NSUserActivity not getting indexed on osx

I'm trying to add my own activity to Spotlight search results on osx 10.11. But after a lot of tries I couldn't got to be in Spotlight search results not by keywords search, not by title search. { self.userActivity = [[NSUserActivity alloc]…
toohtik
  • 1,892
  • 11
  • 27
11
votes
3 answers

NSUserActivity handoff not working for custom data

I'm trying to test out the iOS 8.1 handoff feature with NSUserActivity between my iPhone and my iPad. For this, I tried both implementing my own solution, and to use Apple's PhotoHandoff project. However, it's not working. If I provide a webpageURL,…
Claus Jørgensen
  • 25,882
  • 9
  • 87
  • 150
9
votes
1 answer

How to create a Siri Intent that accepts input passed from user

I created a custom Intent with parameters like so: I've donated it: let intent = PlayIntent() intent.color = color let interaction = INInteraction(intent: intent, response: nil) interaction.donate() and it shows up correctly: However, I'd like an…
David Albers
  • 253
  • 4
  • 10
8
votes
0 answers

How to trigger NSUserActivity continuation (Universal Links opening) in the current app?

Universal Links in iOS9 use the Handoff mechanism to look at a link in an app instead of the browser: Whenever a Universal Link is clicked, iOS activates the corresponding app and calls -application:continueUserActivity:restorationHandler with a…
severin
  • 10,148
  • 1
  • 39
  • 40
7
votes
0 answers

Detecting if the app launched from Handoffs or Universal Links

Is there a reliable/correct way to determine in the application:continueUserActivity:restorationHandler: method if the app was opened as a in my app but I need to be able to distinguish the source without having to add anything to the URL. I've…
timgcarlson
  • 3,017
  • 25
  • 52
7
votes
1 answer

ios Handoff missing NSUserActivity in launchOptions?

I have implemented Handoff in our App and it is working fine for web to app handoff and vice versa, when the app is running in foreground or in the background. However if the app is not running, then if the user launches the app from a web to app…
Lefteris
  • 14,550
  • 2
  • 56
  • 95
7
votes
2 answers

Which properties should be used with CSSearchableItemAttributeSet on NSUserActivity?

I added Web Markup to my website so items will appear in Spotlight Search results when users search in iOS 9. Users can browse the same items in the app, therefore I want to create NSUserActivity objects that link to the web content as users browse…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
7
votes
1 answer

NSUserActivity missing contentAttributeSet property

I'm implementing the iOS9 Search index using NSUserActivities. According to the documentation NSUserActivity there should be a property called contentAttributeSet that is used to add more content to the search item. However looking at the…
Olle Lind
  • 751
  • 5
  • 14
6
votes
0 answers

watchOS 6 and iOS 13 NSUserActivity Handoff Not Working

Since updating to iOS 13 and watchOS 6, I am unable to get the Handoff feature working from Apple Watch to iPhone for any apps that I build. The feature was previously working on my existing custom built apps, but is no longer working since the OS…
de3z1e
  • 411
  • 4
  • 8
6
votes
1 answer

iOS 9 App Search sendUserActivityToServer after it had been invalidated, so doing nothing

I want to index my notes for global search. I used a tutorial by Ray Wenderlich. I added string into info.plist: "myapp.com.notes.note" Here is my object: struct Note { public static let domainIdentifier = "myapp.com.notes.note" public…
Arti
  • 7,356
  • 12
  • 57
  • 122
6
votes
2 answers

Navigating to Specific View Controllers from AppDelegate Methods

At the moment, I have implemented these two methods in my AppDelegate func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool and func application(app:…
5
votes
1 answer

Still receives INStartAudioCallIntent when drop support for iOS 12(INStartCallIntent)

I've meet a strange issue when dropping the support for iOS 12. When handle the user activity from AppDelegate continue userActivity, Although we drop INStartAudioCallIntent and INStartVideoCallIntent for it is deprecated in iOS 13, we still receive…
5
votes
2 answers

Hard Coding NSUserActivityTypes for Restoring Different Data Models

As of iOS 13, Apple recommends storing user state using an NSUserActivity object attached to a scene, so I've been trying to a) better understand how NSUserActivity works and b) implement that in my own code. In working through Apple's…
RyanBDevilled
  • 201
  • 1
  • 2
  • 7
1
2 3 4 5 6 7