Spotlight

RSS for tag

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

Posts under Spotlight tag

113 Posts

Post

Replies

Boosts

Views

Activity

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.7k
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.7k
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
897
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
1.9k
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.6k
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
Why does spotlight hate me?
This query should find everything with a display name of "Safari." That should include, for example, /Applications/Safari.app. [bigbook:/tmp] sef% mdfind 'kMDItemDisplayName == "Safari"c' /Library/Application Support/Apple/Safari /Library/Apple/System/Library/Assistant/Plugins/Safari.assistantBundle/Contents/MacOS/Safari /Users/Shared/Previously Relocated Items 1/Security/System/Library/AssetsV2/com_apple_MobileAsset_MacSoftwareUpdate/f7b05c91052116c046919f72de2c03a86cabcf3e.asset/AssetData/payloadv2/ecc_data/System/Library/Templates/Data/Applications/Safari.app /Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.6.sdk/System/Library/PrivateFrameworks/Safari.framework/Versions/A/Safari /Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.7.sdk/System/Library/PrivateFrameworks/Safari.framework/Versions/A/Safari /Users/sef/Applications/Microsoft Office 2004/Office/Themes/safari /Users/sef/Library/Application Support/SyncService/LastSync Data/Safari And yet, /Applications/Safari.app is in fact missing from there. Why? (This used to work. But then mds was broken on my machine, so I bit the bullet and upgraded to Monterey. Multiple Monterey systems are showing this weird behaviour.)
1
0
837
Jun ’22
Redirect on apple-app-site-association does not break Universal Links
Documentation says that apple-app-site-association file needs to be accessible via HTTPS—without any redirects.However practice shows, that when this file accessible via redirect, Universal Links are working.Is documentation outdated?Can we rely on this behaviour?
Replies
2
Boosts
0
Views
4.9k
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.7k
Activity
Oct ’23
Spotlight AppStore section does not show my app
Hi: When I type on spotlight the name of my app, the App Store section does not show my app to download, unless I write "myAppname app". Also, in the simulator, if I put the app name and keep pressing the option it shows the app, but no in other cases. Any ideas about why it is? Thanks in advance
Replies
0
Boosts
0
Views
850
Activity
Sep ’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.7k
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
897
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
1.9k
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.6k
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
Doing an MDQuery for kMDItemFSName or kMDItemPath doesn't work as I'd expect?
Specifically, it doesn't find anything. (Now, this isn't a huge deal, I was just playing with some queries related to another issue I had, and found that I couldn't search that way.) Is this expected? eg, mdfind 'kMDItemFSName == "/"' finds nothing.
Replies
1
Boosts
0
Views
1.3k
Activity
Aug ’22
Outlook for Mac search feature not working after migration
I migrated from MacBook air 2017 to MacBook air M2 2022. Outlook for Mac launched just fine. Tried to search for an email and came up no results. Using Office 365. Excel and Word search works just fine. Please help.
Replies
1
Boosts
0
Views
1.5k
Activity
Aug ’22
Choose a different iOS app name for Spotlight
I have an app with display name mytest and I'm using the same name for the App Store, I need is to show the app on spotlight search once user try to search for test word. I dont need to use CoreSpotlight framework since its dosn't show the app under Apps section
Replies
2
Boosts
0
Views
1.3k
Activity
Aug ’22
Spotlight not running with norwegian language MacOS ventura beta 5
Hi, I upgraded to MacOS 13 beta 5 and iOS 16 beta yesterday. I noticed that the spotlight service is not running with norwegian language and region. When I change to english (us), it works. Spotlight seems to work on iOS so maybe thw norwegian Spotlight isn’t ready yet?
Replies
2
Boosts
3
Views
1.4k
Activity
Aug ’22
How to manually trigger a CSImportExtension call?
I created an ImportExtension using the template in Xcode, and implemented the -[ImportExtension updateAttributes:forFileAtURL:error:] method. I have tried searching for the corresponding file in Spotlight and the method is not called. How can I make this method be called? Xcode Version: 13.2.1 iOS Version: iOS 15.2
Replies
1
Boosts
1
Views
1.4k
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
How to integrate with iOS Spotlight contact search?
How to make your app show up in Spotlight’s video call option under contact search? As shown in the attached screenshot. Any tutorial is appreciated.
Replies
0
Boosts
0
Views
973
Activity
Jul ’22
Why does spotlight hate me?
This query should find everything with a display name of "Safari." That should include, for example, /Applications/Safari.app. [bigbook:/tmp] sef% mdfind 'kMDItemDisplayName == "Safari"c' /Library/Application Support/Apple/Safari /Library/Apple/System/Library/Assistant/Plugins/Safari.assistantBundle/Contents/MacOS/Safari /Users/Shared/Previously Relocated Items 1/Security/System/Library/AssetsV2/com_apple_MobileAsset_MacSoftwareUpdate/f7b05c91052116c046919f72de2c03a86cabcf3e.asset/AssetData/payloadv2/ecc_data/System/Library/Templates/Data/Applications/Safari.app /Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.6.sdk/System/Library/PrivateFrameworks/Safari.framework/Versions/A/Safari /Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.7.sdk/System/Library/PrivateFrameworks/Safari.framework/Versions/A/Safari /Users/sef/Applications/Microsoft Office 2004/Office/Themes/safari /Users/sef/Library/Application Support/SyncService/LastSync Data/Safari And yet, /Applications/Safari.app is in fact missing from there. Why? (This used to work. But then mds was broken on my machine, so I bit the bullet and upgraded to Monterey. Multiple Monterey systems are showing this weird behaviour.)
Replies
1
Boosts
0
Views
837
Activity
Jun ’22