corespotlight

Get full text of search request from Spotlight?

一笑奈何 提交于 2019-12-11 11:51:27
问题 Since iOS9, it's possible to make Spotlight to show some items from own Application in search results. When user taps on result - App opens with some action handler. My question: is it possible somehow to get the full text of user's search request in application? Example: My application indexes item 'banana' using CoreSpotlight API. User searches: " banana pie ". Spotlight shows result from my App, actually, item " banana ". I would like to get string " banana pie ". I have already tried to

Set title property from NSarray in CSSearchableItemAttributeSet

大憨熊 提交于 2019-12-11 11:31:54
问题 I am trying to using CoreSpotlight API in application , I have plist file which has a several items on it for example animals' name . So I need to set title string equal to on of those object , for example if users search Lion , the line name and for example its features appears on the spotlight . Here is my code : - (void)setupCoreSpotlightSearch { CSSearchableItemAttributeSet *attibuteSet = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(__bridge NSString *)kUTTypeImage];

Attempting to load the view of a view controller while it is deallocating. CoreSpotlight

梦想的初衷 提交于 2019-12-11 10:25:46
问题 I integrate CoreSpotlight in my app. I want that user will find need information in spotlight search and after user will open this information in spotlight information opens in DetailViewController . I made it, spotlight works nice, but when application is opening I see this error Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (UIAlertController: 0x1245a0560) although I don't use UIAlertController . I made in

cannot trigger continueUserActivity in Swift 3 / iOS 10

女生的网名这么多〃 提交于 2019-12-10 11:25:13
问题 Note: I figured most of this out - see the update at the end. Still some confusion. I'm trying to implement NSUserActivity handling in Xc8b6 under Swift 3 and having trouble with the method signature for the handler protocol method. In the current doc, the method is said to be: func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool This differs only slightly from what I see in the swift header interface.

In iOS 11, how to make core data searchable in core spotlight

断了今生、忘了曾经 提交于 2019-12-09 18:49:32
问题 As mentioned at WWDC, iOS 11 should have support to index Core Data so that it is searchable via Spotlight. This is the WWDC presentation: https://developer.apple.com/videos/play/wwdc2017/210/ However, after watching the video and looking at docs, I still have no idea how to setup my core data objects so they are searchable from the phones spotlight search. I guess the main questions are: 1.) How do you actually set which attributes of a certain object type are searchable. 2.) How do you

Unknown Error when adding an CSSearchableItem to Core Spotlight (MacOS)

◇◆丶佛笑我妖孽 提交于 2019-12-06 06:12:31
问题 I recently wanted to power the search in one of my projects with Core Spotlight. However, whenever I add an CSSearchableItem to the SearchIndex, I get an error in the completion handler with the description: The operation couldn’t be completed. (CSIndexErrorDomain error -1.) According to Apple's reference, the error code -1 refers to Unknown Error , which isn't exactly helpful. I added both CoreSpotlight and CoreServices frameworks to my app and I really have no idea of what I might have done

How to get custom value back from Spotlight with CSCustomAttributeKey

六眼飞鱼酱① 提交于 2019-12-05 07:47:03
I am trying to get some data back from Core Spotlight which I am storing using a custom attribute key. Tested this on macOS and iOS as well, the result is always the same. My test class: import CoreSpotlight class SpotlightSearch { let domainId = "com.company.some" let originalDataKeyName: String init() { self.originalDataKeyName = domainId.replacingOccurrences(of: ".", with: "_") + "_originalData" } func addToIndex(title: String, content: String) { guard let originalDataKey = CSCustomAttributeKey(keyName: originalDataKeyName, searchable: false, searchableByDefault: false, unique: false,

Unknown Error when adding an CSSearchableItem to Core Spotlight (MacOS)

谁说胖子不能爱 提交于 2019-12-04 09:36:36
I recently wanted to power the search in one of my projects with Core Spotlight. However, whenever I add an CSSearchableItem to the SearchIndex, I get an error in the completion handler with the description: The operation couldn’t be completed. (CSIndexErrorDomain error -1.) According to Apple's reference, the error code -1 refers to Unknown Error , which isn't exactly helpful. I added both CoreSpotlight and CoreServices frameworks to my app and I really have no idea of what I might have done wrong. I put together a minimal example: import Foundation import CoreSpotlight print("Start indexing.

iOS9系列专题二——全新的搜索功能api

半城伤御伤魂 提交于 2019-12-02 00:44:11
更加智能的搜索方案——iOS9搜索功能新api 一、引言 iOS9中为我们提供了许多新的api,搜索功能的加强无疑是其中比较显眼的一个。首先,我们先设想一下:如果在你的app中定义一种标识符,在siri和搜索中,可以用过这个标识符搜索到你的app,是不是很棒?不,这还差得远,你可以定义任意的数据,使其在搜索和siri中可以快速检索到,这样的搜索功能是不是非常酷?不,还有更cool的,你甚至可以在你的网站中添加一些标志,使apple的爬虫可以检索到,那样,即使用户没有安装你的app,也可以在搜索中获取到相应的信息,这太强大了,对吧。 二、3种全新的搜索模式 ‍1、NSUserActivity‍ 我们可以在项目中使用相应的函数来添加一些用户的活跃元素,使我们可以在搜索中通过搜索这样的活跃元素展现我们的app。例如: //创建一个对象,这里的type用于区分搜索的类型 NSUserActivity *userActivity = [[NSUserActivity alloc] initWithActivityType: @"myapp"]; //显示的标题 userActivity.title = @"我的app"; // 搜索的关键字 userActivity.keywords = [NSSet setWithArray: @[@"sea",@"rch"]]; // 支持Search

Apple-app-site-association not found

二次信任 提交于 2019-12-01 05:51:45
I'm trying to pass the Apple Search Validation Tool , and I'm having problems with the apple-app-site-association. For some reason the bot can't find my file. But if you open the URL it's there. It's not a formatting problem, because the file isn't even found. I have https so it's not needed to sign my file. I don't have any extension on my file, as asked in the documentation. Someone had a similar problem and asked on the Apple Developer foruns , but it didn't help me. My url is https://ps3looke.ottvs.com.br/apple-app-site-association I tried to check it with cUrl and everything seems normal: