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 NSUserActivity class in Xcode 7 shows no property with this name. I'm using Xcode 7 beta 6.
Asked
Active
Viewed 934 times
7

Daniel Galasko
- 23,617
- 8
- 77
- 97

Olle Lind
- 751
- 5
- 14
1 Answers
28
Got it now.
The contentAttributeSet is of type CSSearchableItemAttributeSet
, which is a class in the Core Spotlight framework. So I had to add Core Spotlight to my project and import it in the file I was using NSUserActivity in.
Sneaky sneaky, Apple!

Olle Lind
- 751
- 5
- 14
-
2Same thing happened to me when trying to use the new iOS 14 appClipActivationPayload property in Xcode 12 Beta 3. NSUserActivity says it's there and it compiled fine, but it just wasn't there when the code tried to access it. Just like you, all I had to do was add AppClip.framework to my App Clip target in General / Frameworks, Libraries, and Imbedded Content. Sneaky sneaky, Apple! – ScottyB Jul 29 '20 at 00:08
-
Had the same issue with AppClips, but just calling `import AppClip` in the swift file was sufficient for me. I didn't had to add the AppClip.framework – Jeroen Bakker Mar 13 '23 at 15:19