Spotlight

RSS for tag

Search for files and index your app’s content for searching using Spotlight.

Posts under Spotlight tag

112 Posts

Post

Replies

Boosts

Views

Activity

Does MacOS Sonoma Spotlight still index non-Apple App Content if indexed?
I've recently upgraded to MacOS Sonoma. Spotlight seems to search third-party app names (search for Outlook and you'll find the Outlook app in search results) but it does not seem to surface third-party app content. Is this expected behavior, a widespread bug, or just my issue? For example, Outlook emails, WhatsApp calls, Evernote notes, Venmo contacts, Booking.com stays, Kayak.com trips...used to all be indexed under their respective apps I'm considering indexing my app but first wondering if Sonoma even supports it anymore? Example of App content::
0
0
891
Nov ’23
iOS Spotlight indexing seems to be broken on iOS 17?
Content indexed through CSSearchableIndex.default().indexSearchableItems() is no longer searchable from Spotlight. I created a very small app to demonstrate this. CSSearchableIndex.default().indexSearchableItems() returned no error, yet the result can't be found. import CoreSpotlight import SwiftUI @main struct testspotlightApp: App { var body: some Scene { WindowGroup { ContentView() .onContinueUserActivity(CSSearchableItemActionType, perform: handleSpotlight) } } func handleSpotlight(_ userActivity: NSUserActivity) { print("Found \(userActivity.userInfo?.debugDescription ?? "nothing")") } } import CoreSpotlight import SwiftUI struct ContentView: View { @State var result = "" var body: some View { VStack { Text("Hello!") Button { let attribute = CSSearchableItemAttributeSet(contentType: .text) attribute.title = "a page title" attribute.contentDescription = "hello this is a page" attribute.keywords = ["search", "this", "page", "title"] let item = CSSearchableItem( uniqueIdentifier: "12345", domainIdentifier: "com.test", attributeSet: attribute) CSSearchableIndex.default().indexSearchableItems([item]) { error in if let error { result = "Failed to index: \(error.localizedDescription)" } else { result = "Successefully indexed to spotlight. Try searching 'a page title'" } } } label: { Text("Index a page").font(.title) } Text(result).multilineTextAlignment(.center) } .padding() } } Has anyone else seen the same issue?
16
9
7.9k
Oct ’23
Universal Deep Linking with redirects
I was wondering if it was possible to get Universal Deep Linking working with redirects that open up Safari first. I've successfully gotten deep linking to work when doing a normal link to the site, but when it is behind a link that is created by a marketing company, that link opens up Safari first, then opens the mobile web browser and not the app itself.Is it possible to go from a redirect in Safari to the app?
14
0
38k
Aug ’23
Unable to set the new App Tint Color options for App Shortcuts
I'm working on creating App Shortcuts for my app to show up in the Shortcuts app and Spotlight. One new feature this year is the option to add your apps tint color as a background, but I'm not able to get this to work. I have added the items NSAppIconActionTintColorName (String) and NSAppIconComplementingColorNames (Array?) to my info.plist file that where briefly mentioned in the WWDC23 video, but they don't seem to have any effect. Has anyone got these to work in their project?
3
4
3.8k
Jul ’23
Spotlight/metadata can be so very annoying
sef% mdls /Applications/Google\ Chrome.app/Contents/Frameworks/Google\ Chrome\ Framework.framework/Versions/112.0.5615.137/Helpers/Google\ Chrome\ Helper.app kMDItemFSContentChangeDate = 2023-04-17 23:59:16 +0000 kMDItemFSCreationDate = 2023-04-17 23:59:16 +0000 kMDItemFSCreatorCode = "" kMDItemFSFinderFlags = 0 kMDItemFSHasCustomIcon = 0 kMDItemFSInvisible = 0 kMDItemFSIsExtensionHidden = 0 kMDItemFSIsStationery = 0 kMDItemFSLabel = 0 kMDItemFSName = "Google Chrome Helper.app" kMDItemFSNodeCount = 1 kMDItemFSOwnerGroupID = 0 kMDItemFSOwnerUserID = 0 kMDItemFSSize = 1 kMDItemFSTypeCode = "" sef% mdfind 'kMDItemFSName == "Google Chrome Helper.app"' So there's a metadata key that has a value... but mdfind won't find it. I haven't tried writing a small program to see if it would find it yet, although I am somewhat curious if it would.
0
0
900
May ’23
mdfind - Disable debug output: [UserQueryParser] Loading keywords and predicates for locale "de_CH"
Hey Whenever I run mdfind, it prints some annoying debug output. Example: $ mdfind …………… 2023-04-24 07:21:53.046 mdfind[642:1948002] [UserQueryParser] Loading keywords and predicates for locale "de_CH" 2023-04-24 07:21:53.047 mdfind[642:1948002] [UserQueryParser] Loading keywords and predicates for locale "de" … That's on macOS Ventura 13.3.1 (22E261). I've got another mac with an older macOS, and there mdfind didn't do this. While googling, I found a post on reddit with a "solution", which just filters out those lines from stderr, like so: function mdfind() { /usr/bin/mdfind $@ 2> >(grep --invert-match ' \[UserQueryParser\] ' >&2) } This does not solve the problem, it just hides it. Is there a way to turn off these debug messages? Thanks, Alexander
1
1
2.0k
Apr ’23
App Search API Validation Tool is down
The "Search for Developers" website (https://developer.apple.com/ios/search/) references the App Search API Validation Tool located at https://developer.apple.com/ios/search/. Clicking the link returns an SSL error. The entire subdomain returns this same error (https://search.developer.apple.com).I reported it through Apple's developer feedback, who told me to file a Radar. I filed a Radar and it came back as "could not reproduce."Can anyone else confirm that this site won't load? Perhaps Apple doesn't experience the SSL issue from within its own network?I need to use the validator!
18
0
9.2k
Feb ’23
spotlight/metadata searches are confusing me
In order to set up an asynchronous query looking for a specific application, I have a predicate of:         NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K LIKE[cd] %@ AND %K = %@",                                                          @"kMDItemDisplayName", name,                                                          @"kMDItemContentType", UTTypeApplicationBundle.identifier]; I tested it with standalone code, and this did what I wanted -- finding applications with the given name. But recently, it seems to have stopped working. That query should be the equivalent of mdfind 'kMDItemDisplayName LIKE[cd] "Safari" AND kMDItemContentType == "com.apple.application-bundle"' but that gives me Failed to create query for 'kMDItemDisplayName LIKE[cd] "Safari" AND kMDItemContentType == "com.apple.application-bundle"'. If I drop the compound, and just do % mdfind 'kMDItemDisplayName LIKE[cd] "Safari"' then I get no output: % mdfind 'kMDItemDisplayName LIKE[cd] "Safari"' %  And yet clearly I do have Safari installed on my system. What am I doing wrong, or missing? Anyone?
3
0
1.7k
Jan ’23
NSMetadataQueryDidFinishGathering not being called enough
I have an app where each item in an NSTableView contains an NSMetadataQuery, to listen for updates to image files that contain the keyword associated with the item. If I write the keywords to, RAW files, everything works as expected and the number label in the row gets updated correctly. However, if I write the keywords to XMP sidecar files, the NSMetadataQueryDidFinishGathering callback isn't called enough times and the count of files affected isn't updated correctly. What is more, the number returned on the final call to the callback seems to vary depending on the time of day, weather, etc Here is the code that I have used to create the predicate for finding keywords in XMP files…       let xmpFileTypePredicate = NSPredicate(fromMetadataQueryString: "kMDItemKind = \"XMP sidecar*\"cdwt")!       let xmpKeywordPredicate = NSPredicate(fromMetadataQueryString: "kMDItemTextContent = \"<rdf:li>\(keyword)</rdf:li>\"cdw")!       let xmpKeywordsMetadataQueryPredicate = NSCompoundPredicate(andPredicateWithSubpredicates: [xmpFileTypePredicate, xmpKeywordPredicate]) Can anyone give me any ideas?
0
0
1.1k
Aug ’22
Get notified when a new application is installed?
Is there a way to get a notification of some type when a new application is installed? The specifics here have to do with "Here is a list of applications we want to monitor"; I use mdquery to find them (so I can get the paths, and information from the bundle). However, if it's not installed yet, then I can't do that. But if it gets installed later, I'd like to.
6
0
2.3k
Aug ’22
How do I get information on messages that have been sent in Messages app in iOS?
I have wondered before how I can find out what messages have been sent and perhaps even to whom and from whom. What is the underlying technology behind the search feature in iOS when the user swipes right from the first screen of the home screen? Is that part of Siri. Setting group Siri and Search together. Does the search feature I speak of use Intents, and is that made accessible to developers. I have also noticed that there is an intent property to the extension context object that passes information between a host app and another app's share extension. I'm brainstorming and looking for any ideas. I hope someone out there have good information for me. macOS has Spotlight. Is that available on iOS?
0
0
1.3k
Jul ’22
Monitor progress of ubiquitous item downloads in iCloud Drive
I'm struggling to find a way to monitor the progress (in percent, or bytes) of a download from iCloud Drive. I.e. files outside of the app's ubiquitous document folder. Our app provides a directory browser (which is accessed using a security scoped bookmark granted by the user). In this browser we want to enable users to download files from iCloud analogous to the user experience provided in Files.app. It seems that NSMetaDataQuery would be the right way to go nowadays. However i don't get any results for queries outside of my own app container. I suppose that's a permission problem? Luckily we can get most of what we need using url's resource values. Also initiating and canceling a download works using NSFileManager. However i found now suitable way of determining a download's progress. NSURLUbiquitousItemPercentDownloadedKey is deprecated and doesn't give any results. Did i overlook something? Is there a way to get NSMetaDataQuery working with security scoped bookmarks to folders?
0
1
1.4k
Jul ’22
Does MacOS Sonoma Spotlight still index non-Apple App Content if indexed?
I've recently upgraded to MacOS Sonoma. Spotlight seems to search third-party app names (search for Outlook and you'll find the Outlook app in search results) but it does not seem to surface third-party app content. Is this expected behavior, a widespread bug, or just my issue? For example, Outlook emails, WhatsApp calls, Evernote notes, Venmo contacts, Booking.com stays, Kayak.com trips...used to all be indexed under their respective apps I'm considering indexing my app but first wondering if Sonoma even supports it anymore? Example of App content::
Replies
0
Boosts
0
Views
891
Activity
Nov ’23
iOS Spotlight indexing seems to be broken on iOS 17?
Content indexed through CSSearchableIndex.default().indexSearchableItems() is no longer searchable from Spotlight. I created a very small app to demonstrate this. CSSearchableIndex.default().indexSearchableItems() returned no error, yet the result can't be found. import CoreSpotlight import SwiftUI @main struct testspotlightApp: App { var body: some Scene { WindowGroup { ContentView() .onContinueUserActivity(CSSearchableItemActionType, perform: handleSpotlight) } } func handleSpotlight(_ userActivity: NSUserActivity) { print("Found \(userActivity.userInfo?.debugDescription ?? "nothing")") } } import CoreSpotlight import SwiftUI struct ContentView: View { @State var result = "" var body: some View { VStack { Text("Hello!") Button { let attribute = CSSearchableItemAttributeSet(contentType: .text) attribute.title = "a page title" attribute.contentDescription = "hello this is a page" attribute.keywords = ["search", "this", "page", "title"] let item = CSSearchableItem( uniqueIdentifier: "12345", domainIdentifier: "com.test", attributeSet: attribute) CSSearchableIndex.default().indexSearchableItems([item]) { error in if let error { result = "Failed to index: \(error.localizedDescription)" } else { result = "Successefully indexed to spotlight. Try searching 'a page title'" } } } label: { Text("Index a page").font(.title) } Text(result).multilineTextAlignment(.center) } .padding() } } Has anyone else seen the same issue?
Replies
16
Boosts
9
Views
7.9k
Activity
Oct ’23
Universal Deep Linking with redirects
I was wondering if it was possible to get Universal Deep Linking working with redirects that open up Safari first. I've successfully gotten deep linking to work when doing a normal link to the site, but when it is behind a link that is created by a marketing company, that link opens up Safari first, then opens the mobile web browser and not the app itself.Is it possible to go from a redirect in Safari to the app?
Replies
14
Boosts
0
Views
38k
Activity
Aug ’23
Unable to set the new App Tint Color options for App Shortcuts
I'm working on creating App Shortcuts for my app to show up in the Shortcuts app and Spotlight. One new feature this year is the option to add your apps tint color as a background, but I'm not able to get this to work. I have added the items NSAppIconActionTintColorName (String) and NSAppIconComplementingColorNames (Array?) to my info.plist file that where briefly mentioned in the WWDC23 video, but they don't seem to have any effect. Has anyone got these to work in their project?
Replies
3
Boosts
4
Views
3.8k
Activity
Jul ’23
Spotlight/metadata can be so very annoying
sef% mdls /Applications/Google\ Chrome.app/Contents/Frameworks/Google\ Chrome\ Framework.framework/Versions/112.0.5615.137/Helpers/Google\ Chrome\ Helper.app kMDItemFSContentChangeDate = 2023-04-17 23:59:16 +0000 kMDItemFSCreationDate = 2023-04-17 23:59:16 +0000 kMDItemFSCreatorCode = "" kMDItemFSFinderFlags = 0 kMDItemFSHasCustomIcon = 0 kMDItemFSInvisible = 0 kMDItemFSIsExtensionHidden = 0 kMDItemFSIsStationery = 0 kMDItemFSLabel = 0 kMDItemFSName = "Google Chrome Helper.app" kMDItemFSNodeCount = 1 kMDItemFSOwnerGroupID = 0 kMDItemFSOwnerUserID = 0 kMDItemFSSize = 1 kMDItemFSTypeCode = "" sef% mdfind 'kMDItemFSName == "Google Chrome Helper.app"' So there's a metadata key that has a value... but mdfind won't find it. I haven't tried writing a small program to see if it would find it yet, although I am somewhat curious if it would.
Replies
0
Boosts
0
Views
900
Activity
May ’23
mdfind - Disable debug output: [UserQueryParser] Loading keywords and predicates for locale "de_CH"
Hey Whenever I run mdfind, it prints some annoying debug output. Example: $ mdfind …………… 2023-04-24 07:21:53.046 mdfind[642:1948002] [UserQueryParser] Loading keywords and predicates for locale "de_CH" 2023-04-24 07:21:53.047 mdfind[642:1948002] [UserQueryParser] Loading keywords and predicates for locale "de" … That's on macOS Ventura 13.3.1 (22E261). I've got another mac with an older macOS, and there mdfind didn't do this. While googling, I found a post on reddit with a "solution", which just filters out those lines from stderr, like so: function mdfind() { /usr/bin/mdfind $@ 2&gt; &gt;(grep --invert-match ' \[UserQueryParser\] ' &gt;&amp;2) } This does not solve the problem, it just hides it. Is there a way to turn off these debug messages? Thanks, Alexander
Replies
1
Boosts
1
Views
2.0k
Activity
Apr ’23
App Search API Validation Tool is down
The "Search for Developers" website (https://developer.apple.com/ios/search/) references the App Search API Validation Tool located at https://developer.apple.com/ios/search/. Clicking the link returns an SSL error. The entire subdomain returns this same error (https://search.developer.apple.com).I reported it through Apple's developer feedback, who told me to file a Radar. I filed a Radar and it came back as "could not reproduce."Can anyone else confirm that this site won't load? Perhaps Apple doesn't experience the SSL issue from within its own network?I need to use the validator!
Replies
18
Boosts
0
Views
9.2k
Activity
Feb ’23
spotlight/metadata searches are confusing me
In order to set up an asynchronous query looking for a specific application, I have a predicate of:         NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K LIKE[cd] %@ AND %K = %@",                                                          @"kMDItemDisplayName", name,                                                          @"kMDItemContentType", UTTypeApplicationBundle.identifier]; I tested it with standalone code, and this did what I wanted -- finding applications with the given name. But recently, it seems to have stopped working. That query should be the equivalent of mdfind 'kMDItemDisplayName LIKE[cd] "Safari" AND kMDItemContentType == "com.apple.application-bundle"' but that gives me Failed to create query for 'kMDItemDisplayName LIKE[cd] "Safari" AND kMDItemContentType == "com.apple.application-bundle"'. If I drop the compound, and just do % mdfind 'kMDItemDisplayName LIKE[cd] "Safari"' then I get no output: % mdfind 'kMDItemDisplayName LIKE[cd] "Safari"' %  And yet clearly I do have Safari installed on my system. What am I doing wrong, or missing? Anyone?
Replies
3
Boosts
0
Views
1.7k
Activity
Jan ’23
NSMetadataQueryDidFinishGathering not being called enough
I have an app where each item in an NSTableView contains an NSMetadataQuery, to listen for updates to image files that contain the keyword associated with the item. If I write the keywords to, RAW files, everything works as expected and the number label in the row gets updated correctly. However, if I write the keywords to XMP sidecar files, the NSMetadataQueryDidFinishGathering callback isn't called enough times and the count of files affected isn't updated correctly. What is more, the number returned on the final call to the callback seems to vary depending on the time of day, weather, etc Here is the code that I have used to create the predicate for finding keywords in XMP files…       let xmpFileTypePredicate = NSPredicate(fromMetadataQueryString: "kMDItemKind = \"XMP sidecar*\"cdwt")!       let xmpKeywordPredicate = NSPredicate(fromMetadataQueryString: "kMDItemTextContent = \"<rdf:li>\(keyword)</rdf:li>\"cdw")!       let xmpKeywordsMetadataQueryPredicate = NSCompoundPredicate(andPredicateWithSubpredicates: [xmpFileTypePredicate, xmpKeywordPredicate]) Can anyone give me any ideas?
Replies
0
Boosts
0
Views
1.1k
Activity
Aug ’22
Get notified when a new application is installed?
Is there a way to get a notification of some type when a new application is installed? The specifics here have to do with "Here is a list of applications we want to monitor"; I use mdquery to find them (so I can get the paths, and information from the bundle). However, if it's not installed yet, then I can't do that. But if it gets installed later, I'd like to.
Replies
6
Boosts
0
Views
2.3k
Activity
Aug ’22
How do I get information on messages that have been sent in Messages app in iOS?
I have wondered before how I can find out what messages have been sent and perhaps even to whom and from whom. What is the underlying technology behind the search feature in iOS when the user swipes right from the first screen of the home screen? Is that part of Siri. Setting group Siri and Search together. Does the search feature I speak of use Intents, and is that made accessible to developers. I have also noticed that there is an intent property to the extension context object that passes information between a host app and another app's share extension. I'm brainstorming and looking for any ideas. I hope someone out there have good information for me. macOS has Spotlight. Is that available on iOS?
Replies
0
Boosts
0
Views
1.3k
Activity
Jul ’22
Monitor progress of ubiquitous item downloads in iCloud Drive
I'm struggling to find a way to monitor the progress (in percent, or bytes) of a download from iCloud Drive. I.e. files outside of the app's ubiquitous document folder. Our app provides a directory browser (which is accessed using a security scoped bookmark granted by the user). In this browser we want to enable users to download files from iCloud analogous to the user experience provided in Files.app. It seems that NSMetaDataQuery would be the right way to go nowadays. However i don't get any results for queries outside of my own app container. I suppose that's a permission problem? Luckily we can get most of what we need using url's resource values. Also initiating and canceling a download works using NSFileManager. However i found now suitable way of determining a download's progress. NSURLUbiquitousItemPercentDownloadedKey is deprecated and doesn't give any results. Did i overlook something? Is there a way to get NSMetaDataQuery working with security scoped bookmarks to folders?
Replies
0
Boosts
1
Views
1.4k
Activity
Jul ’22