2016-09-16 2 views
11

पर अनुक्रमित नहीं हो रहा है मैं ओएसएक्स 10.11 पर स्पॉटलाइट खोज परिणामों में अपनी गतिविधि जोड़ने की कोशिश कर रहा हूं। लेकिन बहुत सारी कोशिशों के बाद मुझे स्पॉटलाइट खोज परिणामों में नहीं होना चाहिए, खोजशब्दों की खोज से नहीं, शीर्षक खोज से नहीं।एनएसयूसर एक्टिविटी ओएसएक्स

{ 
    self.userActivity = [[NSUserActivity alloc] initWithActivityType:@"Reverse DNS keyword"]; 

    self.userActivity.title = @"Some title"; 
    self.userActivity.keywords = [NSSet setWithArray: @[@"Some keywords"]]; 
    self.userActivity.eligibleForSearch = YES; 
    self.userActivity.eligibleForHandoff = YES; 
    self.userActivity.eligibleForPublicIndexing = YES; 
    self.userActivity.userInfo = @{@"name" : @"Some name"}; 
    self.userActivity.delegate = self; 
    self.userActivity.requiredUserInfoKeys =[NSSet setWithArray: @[@"name"]]; 
    self.userActivity.needsSave = YES; 

    [self.userActivity becomeCurrent]; 

    NSApp.userActivity = self.userActivity; 
} 

- (void)userActivityWillSave:(NSUserActivity *)userActivity 
{ 
    userActivity.userInfo = @{@"name" : @"Some name"}; 
} 

NSUserActivityTypes सरणी और initWithActivityType से आइटम के साथ इसके अलावा, मैं नवीनीकृत किया है Info.plist: तर्क

भी मैंने देखा है कि कंसोल में कुछ समय संदेशों प्रकट होता है:

16/09/2016 13:14:49.731 Caching encoded userInfo to use until we are marked dirty again (UAUserActivity.m #1567) 
16/09/2016 13:14:49.731 Returning cached encoded userInfo (UAUserActivity.m #1508) 

उत्तर

1

एक के बाद बहुत खोज की, अंत में मुझे TN2416:

**Are these new Search APIs available on OS X?** 

CoreSpotlight and the search functionality of NSUserActivity are not supported on OS X. However, web search results may be shown on OS X. 
में मेरे प्रश्न पर उत्तर मिला
संबंधित मुद्दे