gpt4 book ai didi

ios - NSUserActivity 没有在 osx 上建立索引

转载 作者:技术小花猫 更新时间:2023-10-29 10:53:35 34 4
gpt4 key购买 nike

我正在尝试将我自己的事件添加到 osx 10.11 上的 Spotlight 搜索结果中。但经过多次尝试,我无法通过关键字搜索或标题搜索进入 Spotlight 搜索结果。

{
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)

最佳答案

经过大量搜索,最终我在 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.

关于ios - NSUserActivity 没有在 osx 上建立索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39529454/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com