Post not yet marked as solved
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?
Post not yet marked as solved
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.
Post not yet marked as solved
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.)
Post not yet marked as solved
On my spreadsheet application, with its own UTI, I wrote a Spotlight importer plugin.
It works well, except that Spotlight group the found files as "Other" and not as "Spreadsheet". My UTI conforms to public.spreadsheet. Any idea?
Is there a special kMDxxx key/value to set for that in the importer?(see: https://developer.apple.com/library/archive/documentation/CoreServices/Reference/MetadataAttributesRef/Reference/CommonAttrs.html
)
Thanks!
Post not yet marked as solved
I'm trying to create a quicklink/command (for personal purposes Raycast) that basically opens the App Store and searches input. I don't know much about developing/backend/code stuff but considering it's easy to create a command that searches other browsers, engines, databases I figure there has to be a way. Hoping this isn't like reddit where someone asks a question and everyone answers it condescendingly or sarcastically just because, reddit.
Post not yet marked as solved
I can see a couple of python scripts in indexing folders
/System/Volumes/Data/.Spotlight-V100/Store-V2/<GUID>/Cache/0000/0003/0003/12885148578.txt
Why is the spotlight keeping copies of the files in addition to the indexing metadata?
Are these temporary files and would these be auto-deleted after some known time period?
Post not yet marked as solved
Hi girls & guys!I wonder if I can track traffic that comes from Spotlight or other app deeplinking launches in my analytics.When Spotlight opens my app with a deeplink, can I provide an argument that differs when the user comes from Spotlight or Safari search or opens my url via another way? Reason is: Currently I get traffic to my mobile page via Google. On my page I take the HTTP referrer and know it's SEO-traffic from Google. For SEA Adwords traffic I specify another URL. Means, I can identify my traffic sources.When Spotlight will take over this search part, there will me no HTTP referrer I can take. I then cannot identify if the user comes from Spotlight Search or another app launch way (e.g. smart app banner).Hope somebody has ideas to specify different arguments for sources when deeplinking to an app.Best regards
Consider:
sef% mdfind 'kMDItemDisplayName =[c] "Zoom.us"'
sef%
sef% mdfind 'kMDItemDisplayName =[c] "zoom.us"'
sef%
vs
sef% mdfind 'kMDItemDisplayName == "zoom.us"'
/Applications/zoom.us.app
(Using '==' vs '=' doesn't seem to make a difference.)
Post not yet marked as solved
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
Post not yet marked as solved
Hello, sometimes if I use NSMetadataQuery to obervse my file changes on macOS, it crash for this reason, its odd and i have no clue for this problem becuse in my code I never get results using index, anyone help? thanks!
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[_NSMetadataQueryResultArray objectAtIndex:]: index (251625) out of bounds (251625)'
terminating with uncaught exception of type NSException
abort() called
Post not yet marked as solved
Hi, guys.I have an issue with Core Spotlight on macOS. I've tried sample app (Pictures from WWDC Core Spotlight topic) and it does not work (10.13 beta 3, XCode 9 beta 3). The app is running but no search results appear in Spotlight. Same issue with Quick Look preview (no results). Seems like indexing is not working. Thanks in advance.
Post not yet marked as solved
I'd like to add additional metadata regarding image files to Spotlight's index, so that I can see the data in Get Info in Finder. I don't want to replace Apple's image indexer; I just want to add one more field.
I am able to successfully create a new Spotlight indexer for a custom file type, and it works; in particular, I can see the new metadata in the Get Info window for the file in Finder.
When I modify the indexer to also accept jpeg files, I'm seeing that Spotlight is choosing to use macOS' built-in image indexer all the time, and never my custom indexer. (I'm using mdimport -d2 -t sample.jpeg for testing)
Before I start asking about code-level questions, it seems prudent to start with the basics:
Is Spotlight willing to leverage multiple indexers for the same file type?
Does mdimport -d2 -t sample.jpeg only test one single indexer? If not, what is the correct way to test an indexer that accepts file types already accepted by an Apple indexer?
Post not yet marked as solved
I'm on a MacBook Air M1 with Monterey and XCode 13 beta. On the first night my MBA ran out of battery within three hours. I check cpu usage, and it was Spotlight. Left it running for hours and hours, but Spotlight did not complete it's tasks. Then I noticed in an Activity Monitor sample output that it seemed to have a relation to the Xcode simulator. I quit that, and the cpu utilisation went down.
I can reproduce it. Nothing special, an empty iOS App in an iPhone 12 Pro or mini simulator will cause busy cpu cores with Spotlight.
I recommend not leaving the simulator running when on battery if you have the same issue ;)
Anyone else seeing Spotlight taking up a lot of CPU resources when the Xcode simulator is running?
Post not yet marked as solved
I created a CSImportExtension in my UIDocument-based app to make the content of my documents searchable.
Now I can successfully search for the content from the iOS home-screen search. But when I try the same search in the Files.app or from the document browser in my app, no results are shown.
In the update attributes function in the extension, I am populating the following fields of the passed-in CSSearchableItemAttributeSet: keywords, contentDescription, displayName
Does anybody know what I have to do to make the content searchable from all locations? I tried the same within the Pages, Numbers and Keynote apps and their document contents is found beautifully from the Files.app or from their document browsers. So it seems to work in principle.
Thanks and cheers
Frank
Post not yet marked as solved
Could you help me find the answer to the following question:
Can I use UTTypeApplication on the CSSearchableItemAttributeSet to index the app data in the Appstore? If yes, please tell me how or send a link to instructions
Post not yet marked as solved
Using Spotlight, the currently available shortcuts of the Shortcuts app can be displayed and opened/started under macOS 12. Since I would like to display a list of available shortcuts in my application, I wonder how this could be realized.
Using NSMetadataQuery and the corresponding NSPredicate Spotlight can be accessed and searched. Files, directories and various other information can be requested from Spotlight this way, but I can't find a suitable search filter to give me the available shortcuts.
Does anyone here have any ideas?
Hello everyone,
this is my first question here,
we (me and my wife) wrote our first iOS app, GraphMath, which is a graphic calculator,
and released it in August, it is in AppStore, can be downloaded, here is the link,
https://apps.apple.com/us/developer/yuri-morozov/id1582368813
but cannot be found by its name, GraphMath.
If you put "graphmath" in the search, it will return a lot of related or unrelated apps. When we first released it on Aug 24, this was the case, then after an update and call to Customer service the second version appeared in the search for a day or two, but then, after the next release, disappeared again, and this was and still is the case for the last almost 2 months, despite multiple calls to App Developer support and their assurances that they are "actively working on it".
There is no other app called GraphMath, there is only a GraphMath2, which also cannot be found by searching "graphmath", but can be by its full name, "graphmath2"
What is also interesting that AppStore algorithm knows about our app: if you add almost any word, like "graphmath math" or "graphmath graph" or "graphmath calculator" or even "graphmath ipad", it will find it, along with that other Graphmath2.
Even more interestingly, if you put "graphmath graphmath" (meaning do not add ANY extra info, besides the keyword graphmath), it returns our app,
but it still does not return it if you just put "graphmath"...
I have searched the forum and found several questions like this (mostly from 3-4 years ago), but could not find any resolution,
does anybody know anything about it?
thanks!
Post not yet marked as solved
I have added the contents of my app to iOS Spotlight via the CSSearchableItemAttributeSet and it is very easy to find them from spotlight in use.
I'd like to achieve a similar effect in the app via CSSearchQuery, but I'm currently running into a problem.
In the system's spotlight, users can use fuzzy queries to find the information they want.
I can't enter Chinese characters in the forum, 'hello' should be Chinese characters
for example, if my content is in Chinese, 'hello', users can find the content not only by 'hello' but also by using 'nihao' to find the same content.('nihao' is the Latin pinyin equivalent of the Chinese word 'hello').
However, I am unable to achieve a similar effect in CKSearchQuery. At the moment CKSearchQuery only has [cdwt] four ways, is there any other means to achieve the above query capability.
Or perhaps Apple does not have this capability open in CKSearchQuery.
Hi all,
I’m trying to use NSMetadataQuery on iOS to track changes to folders users have imported from elsewhere but, no matter what I try, I get no results.
Following the documentation for searching file metadata with NSMetadataQuery,
I’m creating a live query (albeit in Swift) and listening for […]QueryDidFinishGathering and […]QueryDidUpdate. The former fires, with no results, and the latter never fires.
I’ve also tried following the Synchronizing Documents in the iCloud Environment example, adding the appropriate Ubiquity keys to my Info.plist and .entitlements file, with no change.
I’m importing files and folders using SwiftUI’s View.fileImporter(isPresented:allowedContentTypes:allowsMultipleSelection:onCompletion:), but can’t see how I might security-scope the NSMetadataQuery’s execution (if that’s even a thing?).
My test project is on GitHub, but the main parts are below…
My query method:
extension NSMetadataQueryUbiquitousExternalDocumentsTestApp {
func findAccessibleFiles() {
query.stop()
fileMonitor?.cancel()
fileMonitor = Publishers.MergeMany(
[
.NSMetadataQueryDidFinishGathering,
.NSMetadataQueryDidUpdate
].map { NotificationCenter.default.publisher(for: $0) }
)
.receive(on: DispatchQueue.main)
.sink { notification in
query.disableUpdates()
defer { query.enableUpdates() }
foundItems = query.results as! [NSMetadataItem]
print("Query posted \(notification.name.rawValue) with results: \(query.results)")
}
query.searchScopes = [
NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope
]
query.predicate = NSPredicate(
format: "%K LIKE %@",
argumentArray: [NSMetadataItemFSNameKey, "*"]
)
query.sortDescriptors = [
NSSortDescriptor(key: NSMetadataItemFSNameKey, ascending: true)
]
if query.start() {
print("Query started")
} else {
print("Query didn't start for some reason")
}
}
}
Info.plist:
[…]
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.com.stevemarshall.AnnotateML</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>AnnotateML</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>ANY</string>
</dict>
</dict>
[…]
Post not yet marked as solved
I have a SpotLight importer for my custom document type. At one point it was working, but apparently it stopped working a while ago. After rebuilding the SpotLight index (-E) in the course of debugging, the few documents that previously worked no longer work.
I have tested the importer using mdimport -t -d3 and the output looks reasonable.
However, if I do a simple search such as mdfind 'kMDItemTextContent == "gasoline or propane"', the text is not found, even though it is present in the importer output. In fact, if I save the importer output to a file, the text is found in that file.
The console log contains many instances of this error from mdworker_shared:
All kCFPreferencesCurrentUser domains in this process will be volatile, because homeDirPath starts with /var/empty
Is there anything I can do to figure out what is going wrong?
I'm running on macOS 11.5.1.