【问题标题】:How to add call button to search result in CoreSpotlight?如何在 CoreSpotlight 的搜索结果中添加呼叫按钮?
【发布时间】:2015-09-30 09:46:48
【问题描述】:

在 WWDC 会议中搜索 API 简介。他们显示带有呼叫按钮的 Airbnb 应用程序的搜索结果。从我所见,我认为结果是使用CSSearchableItemAttributeSet 而不是来自 Web Markup api 创建的。 我尝试将 CSSearchableItemAttributeSet 的 ItemContentType 设置为 kUTTypeItemkUTTypeMessagekUTTypeEmailMessage,当然还有 phoneNumbers 值。它们似乎都不起作用。我输入的所有细节都显示正确,除了通话按钮。

CSSearchableItemAttributeSet *attributeSet = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(__bridge NSString *)kUTTypeItem];
attributeSet.title = @"Call me back";
attributeSet.contentDescription = @"Firstname Lastname\n14:36 - 30 January 2014";
attributeSet.phoneNumbers = @[@"+66827364538"];
attributeSet.accountHandles = @[@"+66827364538"];

如果我使用kUTTypeContent。呼叫按钮出现,但所有详细信息均未出现。只是我在创建 CSPerson 对象时输入的联系人姓名。

CSPerson *person = [[CSPerson alloc] initWithDisplayName:@"Theptai Intathep"
                                                     handles:@[@"+66827364538"]
                                            handleIdentifier:CNContactPhoneNumbersKey];
attributeSet.authors = @[person];

【问题讨论】:

    标签: ios objective-c ios9 corespotlight


    【解决方案1】:

    试试这个:

    attributeSet.supportsPhoneCall = @(YES);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-11
      • 1970-01-01
      • 1970-01-01
      • 2018-02-24
      • 1970-01-01
      • 1970-01-01
      • 2017-10-30
      相关资源
      最近更新 更多