【发布时间】:2016-12-16 10:33:35
【问题描述】:
我有一个CSSearchableItem 和CSSearchableItemAttributeSet,
CSSearchableItemAttributeSet* attributes = [[CSSearchableItemAttributeSet alloc]initWithItemContentType:(__bridge NSString *)kUTTypeContact];
attributes.keywords = @[keywords];
attributes.title = @"Contact Details";
attributes.displayName = @"Ram Gandhi";
attributes.emailAddresses = @[email];
attributes.phoneNumbers = @[phoneNumber];
attributes.contentDescription = [NSString stringWithFormat:@"%@ \n %@", phoneNumber, email];
attributes.supportsPhoneCall = [NSNumber numberWithBool:YES];
attributes.supportsNavigation = [NSNumber numberWithBool:NO];
attributes.thumbnailData = [self getThumbnailData:contactID];
一切正常,但contentDescription 中的换行符没有按预期工作,尽管它没有显示在 UI 中。
我也不确定在这里使用kUTTypeContact 的目的,因为kUTTypeContent 可以完成这项工作。据我搜索,没有关于如何在 Spotlight 搜索中使用kUTTypeContact 的详细文档。
我可以使用任何其他属性来在不同的行中显示电子邮件和电话号码吗?
【问题讨论】:
-
以前的,iOS10好像已经停止工作了。你有没有运气解决这个问题?
-
Nope.. 就目前而言,我们必须使用适合我们需要的 ItemContentType 和属性,以便将其呈现在其默认 UI 中。
-
我们有关于每个 ItemContentType 如何呈现的文档吗?他们中的任何一个都允许多行描述吗?
-
我在这里使用了 kUTTypeMP3 并尝试了“描述音乐”中的一些道具,developer.apple.com/reference/corespotlight/…
-
我使用了音乐流派和艺术家键来获得第二行。有什么办法可以上三线?我有大部分钥匙,但没有
标签: ios objective-c corespotlight