How to delete a specific NSUserActivity search index?
<p>I use <code>NSUserActivity</code> to index a user activity for searching. I found a solution to delete a specific <code>NSUserActivity</code>, assign a <code>CSSearchableItemAttributeSet</code> with <code>relatedUniqueIdentifier</code> to <code>NSUserActivity</code>:</p>

<pre><code>let attributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeContact as String)
attributeSet.relatedUniqueIdentifier = objectId

let activity = NSUserActivity(activityType: Employee.domainIdentifier)
activity.title = name
activity.userInfo = userActivityUserInfo
activity.keywords = [email, department]
activity.contentAttributeSet = attributeSet
</code></pre>

<p>And delete it use </p>

<pre><code>[[CSSearchableIndex defaultSearchableIndex] 
deleteSearchableItemsWithIdentifiers: objectId completionHandler:^(NSError *deletionError) {  
        if (deletionError) {  
            NSLog(@"Could not delete items from the search index with error %@", deletionError);  
        }  
    }]; 
</code></pre>

<p>I don't know if it is a right solution or not. Do you have a better solution to delete a specific <code>NSUserActivity</code> search index?</p>