I read this thread https://developer.apple.com/forums/thread/788979 thoroughly, but I’m still confused regarding indexing files content.
I'm building a notes app where the notes are stored in files. A file can contain several notes (think paragraphs). Each note and the file document itself have a unique ID, all embedded in the file. So far so good, when the user opens a file in the app, I index all the notes in it using several CSSearchableItem, one for each note. Each CSSearchableItem gets a unique ID based on the note and file IDs.
The notes are then visible in Spotlight search and when the user taps one of them, the app is called with a Spotlight activity and I present the note.
I learned that I should create a CSImportExtension to allow the system to index files when app is not running. But the only method is update(_:forFileAt:), which allows to provide back to the system a single attributes set. How can I index the notes in a file as separate items?
What happens if an iCloud document file is edited remotely and the app is not running, or is editing another file? Does the system detect it and run CSImportExtension on the file?
All the notes and documents IDs are unique, and when the user duplicates the document file from within the app, new unique IDs are set in the duplicate file. But the user can also duplicate files outside the app, in which case the IDs remain the same in the duplicate file. How does Spotlight react to indexing two distinct items, with the same ID, but different 'contentURL'?
What if I index a note from a file, and set the current contentURL of the file, and then the user moves the file. Next time when I index a note from this file, Spotlight will get an item with the same uniqueIdentifier but with a different contentURL. Won't this confuse the system?
How to handle the case of deleted files: Unless a file is pending editing, the app doesn’t know it has been deleted, so it won’t remove the corresponding items from Spotlight.
I should mention that I use a Core Data database, which stores the mapping from file document IDs to file URLs, actually to bookmarks, so I can track the files even if the user renames or moves them.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
How can I insert a UISearchBar in the middle of the shortcuts bar displayed above the keyboard on iPad?
You insert custom shortcuts in the shortcuts bar using 'someTextField.inputAssistantItem' with 'leadingBarButtonGroups' or 'trailingBarButtonGroups' properties, but it has no 'middleBarButtonGroups'.
If I add the search bar as 'inputAccessoryView', like 'someTextField.inputAccessoryView = UISearchBar()' it is added above the shortcuts bar.
I have a simple task, to measure the height of the overlapping area occupied by the keyboard in the current view. In the attached images, I use it to position a UITextView (red) above the keyboard, as a test.
The keyboard displays an inputAccessoryView (yellow) when editing a text view, but it’s also summoned by a UIFindInteraction, which shows a search bar above the keyboard. When measuring the keyboard, I need to account for either the accessory view or the search bar, basically, the total keyboard height including any extra views above it.
I use the usual algorithm: the keyboard frame from UIResponder.keyboardWillShowNotification (documented as being in screen coordinates) is converted to my view’s coordinates and intersected with the view’s bounds to get the overlapping height.
The first issue: in windowed mode, the keyboard frame reports a negative origin.x (e.g. -247), even though in screen coordinates it should start at 0. I display the raw frame in the navbar, as shown in the first screenshot.
I then suspected the frame might be in window coordinates on iOS 26, but repositioning the window a few times, and switching between find interaction keyboard and text editing keyboard, sometimes yields a positive origin.x instead, as if the keyboard starts from the middle of the screen!? (see the second screenshot).
And in some cases, the raw keyboard height is even 0, despite the keyboard clearly being visible and taking space (third screenshot).
Interestingly, the reported frame for the search keyboard is always consistent and in screen coordinates, but the default keyboard frame just doesn’t make sense.
I'm trying to upload an app to AppStoreConnect but Xcode (15.0 release not beta) crashes while creating the IPA - I think it's at this step, as it happens very fast. The agreements are all accepted, I don't know what else should I do ??
Here's the log:
-------------------------------------
Process: Xcode [2147]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 15.0 (22265)
Build Info: IDEApplication-22265000000000000~3 (15A240d)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2023-09-24 11:08:28.8476 +0300
OS Version: macOS 13.5.2 (22G91)
Report Version: 12
Anonymous UUID: AC134C1E-4270-BC50-46BA-0FC5F300594C
Time Awake Since Boot: 590 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: archive info plist lock
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process: Xcode [2147]
Application Specific Information:
abort() called
com.apple.main-thread
Application Specific Signatures:
NSInvalidArgumentException
Application Specific Backtrace 0:
0 CoreFoundation 0x00000001a3543154 __exceptionPreprocess + 176
1 DVTFoundation 0x0000000102713e30 DVTFailureHintExceptionPreprocessor + 388
2 libobjc.A.dylib 0x00000001a30624d4 objc_exception_throw + 60
3 CoreFoundation 0x00000001a362d9b8 -[__NSCFString characterAtIndex:].cold.1 + 0
4 CoreFoundation 0x00000001a363ac10 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
5 CoreFoundation 0x00000001a3456ae0 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 320
6 CoreFoundation 0x00000001a3456974 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 52
7 IDEFoundation 0x0000000108a55ac8 -[IDEArchiveDistributionRecord dictionaryRepresentation] + 296
8 IDEFoundation 0x0000000108a37180 __31-[IDEArchive setDistributions:]_block_invoke + 16
9 DVTFoundation 0x000000010270bb2c -[NSArray(DVTFoundationClassAdditions) dvt_arrayByApplyingBlock:] + 224
10 IDEFoundation 0x0000000108a37110 -[IDEArchive setDistributions:] + 84
11 Foundation 0x00000001a440ad94 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 604
12 Foundation 0x00000001a4434f00 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 64
13 Foundation 0x00000001a444e42c _NSSetObjectValueAndNotify + 284
14 IDEFoundation 0x0000000108a36f08 __36-[IDEArchive addDistribution:error:]_block_invoke + 156
15 libdispatch.dylib 0x00000001a323c400 _dispatch_client_callout + 20
16 libdispatch.dylib 0x00000001a324b97c _dispatch_lane_barrier_sync_invoke_and_complete + 56
17 DVTFoundation 0x0000000102758014 DVTDispatchBarrierSync + 148
18 DVTFoundation 0x00000001027342b4 -[DVTDispatchLock performLockedBlock:] + 60
19 IDEFoundation 0x0000000108a36d30 -[IDEArchive addDistribution:error:] + 200
20 IDEFoundation 0x00000001086dc2f0 __35-[IDEDistributionUploadStep upload]_block_invoke.115 + 116
21 DVTFoundation 0x0000000102757330 __DVT_CALLING_CLIENT_BLOCK__ + 16
22 DVTFoundation 0x0000000102757b08 __DVTSyncPerformBlock_block_invoke + 68
23 CoreFoundation 0x00000001a34ca1d4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 28
24 CoreFoundation 0x00000001a34ca0e8 __CFRunLoopDoBlocks + 364
25 CoreFoundation 0x00000001a34c958c __CFRunLoopRun + 2432
26 CoreFoundation 0x00000001a34c84b8 CFRunLoopRunSpecific + 612
27 HIToolbox 0x00000001acd1adf0 RunCurrentEventLoopInMode + 292
28 HIToolbox 0x00000001acd1ac2c ReceiveNextEventCommon + 648
29 HIToolbox 0x00000001acd1a984 _BlockUntilNextEventMatchingListInModeWithFilter + 76
30 AppKit 0x00000001a66ef97c _DPSNextEvent + 636
31 AppKit 0x00000001a66eeb18 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
32 DVTKit 0x0000000102fd8a9c -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 300
33 AppKit 0x00000001a66e2f7c -[NSApplication run] + 464
34 DVTKit 0x0000000102fd7cbc -[DVTApplication run] + 60
35 AppKit 0x00000001a66ba3cc NSApplicationMain + 880
36 dyld 0x00000001a3093f28 start + 2236
Application Specific Backtrace 1:
0 CoreFoundation 0x00000001a3543154 __exceptionPreprocess + 176
1 DVTFoundation 0x0000000102713e30 DVTFailureHintExceptionPreprocessor + 388
2 libobjc.A.dylib 0x00000001a30624d4 objc_exception_throw + 60
3 CoreFoundation 0x00000001a362d9b8 -[__NSCFString characterAtIndex:].cold.1 + 0
4 CoreFoundation 0x00000001a363ac10 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
5 CoreFoundation 0x00000001a3456ae0 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 320
6 CoreFoundation 0x00000001a3456974 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 52
7 IDEFoundation 0x0000000108a55ac8 -[IDEArchiveDistributionRecord dictionaryRepresentation] + 296
8 IDEFoundation 0x0000000108a37180 __31-[IDEArchive setDistributions:]_block_invoke + 16
9 DVTFoundation 0x000000010270bb2c -[NSArray(DVTFoundationClassAdditions) dvt_arrayByApplyingBlock:] + 224
10 IDEFoundation 0x0000000108a37110 -[IDEArchive setDistributions:] + 84
11 Foundation 0x00000001a440ad94 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 604
12 Foundation 0x00000001a4434f00 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 64
13 Foundation 0x00000001a444e42c _NSSetObjectValueAndNotify + 284
14 IDEFoundation 0x0000000108a36f08 __36-[IDEArchive
All is fine in Xcode15, no LLDB errors whatsoever, but in Xcode16 I can't get any variable displayed in the console because of the following error:
error: type for self cannot be reconstructed: type for typename "$......." was not found (cached)
error: Couldn't realize Swift AST type of self. Hint: using `v` to directly inspect variables and fields may still work.
I've checked the output of swift-healthcheck and there are several messages like this:
SwiftASTContextForExpressions(module: "ROA", cu: "ROA+ViewLayer.swift")::LoadOneModule() -- Missing Swift module or Clang module found for "UIKit", "imported" via SwiftDWARFImporterDelegate. Hint: Register Swift modules with the linker using -add_ast_path.
I added -add_ast_path to the OTHER_LDFLAGS in the faulty module's build settings but no luck.
How can I debug my project in Xcode16?
Is there any way to add a toolbar title menu in macCatalyst? I've found 'toolbarTitleMenu(content:)' but that's SwiftUI.
I have created a widget and added a button in its body like this: Button("Tap me: ", intent: TaskIntent()).
If I compile the TaskIntent in both the app and the widget, when tapping the button, it open the app and that's all, 'perform' is not called at all.
If I compile the TaskIntent only in the widget, when tapping the button, it does nothing, 'perform' is not called either.
Is there any special sauce needed to run the 'perform' of the AppIntent attach to the button?