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?
Spotlight
RSS for tagSearch for files and index your app’s content for searching using Spotlight.
Posts under Spotlight tag
25 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
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>
[…]
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
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?
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
Has anyone else experienced issues with Spotlight losing indexing of the Applications?
Spotlight no longer displays any applications in the results when typing in an application name.
Additionally it appears to be ignoring the settings of "Spotlight" set within the preferences. Example: I have "Websites" & "Siri Suggestions" turned off, however these still appear in the search results of spotlight.
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::
Hi,
in the current Beta 2 of MacOS 14.2 the spotlight search is always disappearing after having put in at least one letter after about 1 second.
I like to find a way to identify network volumes, and whether they're run by certain servers, e.g. specifically whether they're on a Synology NAS.
Reason is that Synology, while apparently supporting the Spotlight-over-SMB API, comes with a lot of bugs, requiring me to work around them when searching on those volumes with the macOS Spotlight API.
I could, of course, ask the user to "configure" each mounted volume in my software, but I'd rather do this automagically, if possible, as it's less prone to user mistakes.
So, my question is: Is there a way to learn a bit more about the server of a mounted network volume? E.g., if I could learn its IP address, I could try to connect to it via http protocol and then maybe get a useful response that identifies it as being from Synology.
Or, alternatively, can I tell which SMB volumes are served by a Mac, so that I can at least assume that those handle Spotlight calls correctly, while I assume anything else is buggy (so far, AFAIK, Synology is the only other SMB server that supports Spotlight search).
I've tried to find some data in the IORegistry, but that doesn't seem to store anything about network vols. The statfs function doesn't seem to give me anything for that either, nor do the various fcntl calls as far as I could tell.
I also checked with the DA apis, e.g.:
DASessionRef daSession = DASessionCreate (NULL);
CFURLRef furl = CFURLCreateWithFileSystemPath(NULL, CFSTR("/Volumes/TheNAS"), kCFURLPOSIXPathStyle, true);
DADiskRef daDisk = DADiskCreateFromVolumePath (NULL, daSession, furl);
if (daDisk) {
CFDictionaryRef daInfo = DADiskCopyDescription (daDisk);
NSLog(@"%@", daInfo);
}
However, this only prints basic information:
DAVolumeKind = smbfs;
DAVolumeMountable = 1;
DAVolumeName = TheNAS;
DAVolumeNetwork = 1;
DAVolumePath = "file:///Volumes/TheNAS/";
Where, then, does Finder's "Get Info" get the smb path from, for example?
Like the image showing, the element 'Ask ChatGPT' attaches below siri search suggestion , I guess SiriKit or Spotlight can implement it.
But i searched a lot, no one introduct the detail technology.
Do anyone ever implement it?
Please help me. Thanks.
Looking at the path name for reasons, and ran into a thing: one of my coworkers was not getting /Applications/Safari.app as expected, but instead got /System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app. Which is annoying because I'm actually using spotlight to find the paths for applications, and that one doesn't show up.
Has anyone run into this? And know why?
(I figure I'll simply remove the prefix if it's there, and that should be fine, but I'm curious why it only seems to happen sometimes.)
I am exploring Appi-Intent and Appshortcut. We can create an action shortcut by using the following code.
struct WatchListShortcut: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: WatchListAppIntent(),
phrases: [
"Tell \(.applicationName) to open first item in watch list",
],
shortTitle: "WatchList item",
systemImageName: "systemimage"
)
}
}
What I want to show an entity shortcut like shown in the below screenshot.
linkText
I am not sure how to create the shortcut like Assigned one in the above screen.
In this picture, users can find '楽天ラクマ' by entering 'メルカリ'. How do I set keywords link 'メルカリ' for an app link '楽天ラクマ'.
I thought the apps searched in App Library in iPhone by only their name (CFBundleDisplayName), but it is not fact.
After watching https://developer.apple.com/wwdc24/10131, I'm curious if the semantic embeddings used to provide the "search of meaning" with this new capability are encoded with multi-lingual embeddings?
In particular, if I have content that is mixed in Korean and English, can those be seamlessly indexed together and queries in one language (english) find relevant content that was offered to be indexed as Korean?
Hey there I've been clearing through my storage and found that CoreSpotlight specifically the index.spotlightV3 folder is taking up 213gb of storage which is ridiculous and was wondering if there is a fix for this?
Thanks!
I'm writing a virtual file system as my educational project (generic kernel extension). Currently, mostly everything is implemented, however, I'm having trouble using Finder search and tags. The results simply don't show up - despite I am having vnop_... calls to those files.
The extended attributes are supported.
Inodes are stable.
Mmap is implemented. Vnop_ioctl returns KERN_SUCCESS (but no implementation).
An important moment: Previously, the search didn't work at all. Researching the web has shown me, that Spotlight indexation and Finder search are tightly glued. So basically I was trying to enable support for spotlight, thinking that would be the source of the problem. I was receiving "Unknown indexing state". All those tricks with mdutil, launchd, manual and reindexation either were doing nothing or returning error.
The problem was resolved FOR SONOMA by making by VFS appear as local one (adding flags for MNT_LOLCAL and MNT_DOVOLFS). This has changed the state from Unknown indexing state for spotlight to Indexing is disabled. No need to turn it on for me - I am interested only in search and tags, not the spotlight itself. Basically, whether spotlight recognises my driver as no-error, the Finder works correctly, even with indexation disabled.
Whether on Monterey*, or Ventura, I get the same problem. However, neither system logs nor my driver show any kinds of errors. The spotlight simply returns error. Reindexation attempt via Security&Privacy returns "Unknown error occured". The metadata for Ventura and Monterey read attempt (mdls) returns "Unable to locate file", however returns a huge list for Sonoma.
*Monterey and Ventura never have .Spotlight-V100 folder. No disable indexing files or other spotlight restrictions are present. No user space solutions seem to help.
The kext is unsigned and running in an environment with SIP disabled and Security Mode reduced to Permissive.
Maybe there some abstract rules for what is required on VFS side to be recognised okay'ish by Spotlight ? Or maybe something specific right for my case ?
Any pointers and/or assistance would be greatly appreciated.
I'm trying CoreSpotlight on the 18b1 seed on iOS and after submitting my query, I'm getting multiple errors about what looks like missing models:
[Model loading] model loading failed with err -1000 for model path /Users/hunter/Library/Developer/CoreSimulator/Devices/0AF4F46E-5510-4458-B61C-F8A153155809/data/Containers/Data/Application/1D8580C0-AC80-4949-9FDA-31DB463BDA5C/Library/Spotlight/Resources_V3/Default/models/spotlight_l2.mlmodelc and directives path /Users/hunter/Library/Developer/CoreSimulator/Devices/0AF4F46E-5510-4458-B61C-F8A153155809/data/Containers/Data/Application/1D8580C0-AC80-4949-9FDA-31DB463BDA5C/Library/Spotlight/Resources_V3/Default/directives/directives_l2.mdplist
I am calling CSUserQuery.prepare() but that doesn't seem to make a difference.
Is there more to this than what is on this page? https://developer.apple.com/documentation/corespotlight/building-a-search-interface-for-your-app?changes=latest_minor
Hey everyone!
I'm trying to make an iOS app discoverable (in the App Library) with different keywords than its display name. I've experimented with CFBundleName, but it hasn't worked, and I couldn't find any official documentation on it.
Has anyone successfully done this or have any tips? I'd love to hear your insights!
hey guyss…. Im currently using ios18 developer beta 2 on my iphoen 12…Idk if u guys noticed it or not.. but when i turn off the toggle for “Help improve apple search” (settings->search->help improve apple search)
it again turns on without my knowledge seconds aftr i close the page. Ive tried restarting my iphone & many more.. nothing seems to work.. im kindoff a more private guy i usually turn off apple analytics.. usage diagnostics and i always make sure data is stored only on my local storage.. and this bug kinda piss me off 😕.
i’ve given u the link below to check it out.
Peace.
https://youtube.com/shorts/YfVDCA-Dfrs?si=qLcl0mWL-Jm9iJFz
In WWDC24 video https://developer.apple.com/videos/play/wwdc2024/10131/ Jennifer mentioned that the app she's talking about would be available in the link below, but there's no such link provided.
Where the mentioned app code could be found?