Post

Replies

Boosts

Views

Activity

Xcode shows that variable is nil but it isn't
When evaluating some variables holding an optional value in the debugger with e variable, Xcode prints something like (Bool?) $R3 = nil. This gives the impression that the value is nil (what else should it mean?) and hovering that variable in the code editor also shows a popover with the content nil, but evaluating e variable?.description shows that it holds some value, for example (String?) $R4 = "false" (as a validation, the command e variable == false prints (Bool) $R6 = true. I submitted a bug report on November 2019, more than 2 years ago, and it never got any response. Is it possible that this is the expected behavior? Why can nobody fix it? I'm constantly wasting time because of this bug that causes me to make wrong assumptions during debugging.
0
1
834
Jan ’22
Getting clicked item index in NSPathControl with pathItems instead of pathComponentCells
Since NSPathControl.setPathComponentCells(_:) and .clickedPathComponentCell() are deprecated, I'm trying to use pathItems and clickedPathItem instead. Since I'm representing a virtual path, I cannot use the NSPathControl.url setter, but instead set pathItems directly. The problem is that in the action method it doesn't seem possible to get the index of the clicked path item, nor does it seem possible to associate any kind of data with each path item, since when the action method is called, the actual object instances stored in pathItems and also the one returned by clickedPathItem change every time. Here is the sample code that reproduces the issue: class ViewController: NSViewController {     @IBOutlet weak var pathControl: NSPathControl!          override func viewDidLoad() {         super.viewDidLoad()         pathControl.pathItems = ["a", "b", "c"].map({ title in             let item = NSPathControlItem()             item.title = title             return item         })     }     @IBAction func selectPath(_ sender: NSPathControl) {         print(sender.clickedPathItem!.description, sender.clickedPathItem!.title, sender.pathItems.description)     }      } Here is a sample output (notice how the printed addresses change every time): <NSPathControlItem: 0x6000012780a0> a [<NSPathControlItem: 0x6000012780a0>, <NSPathControlItem: 0x600001278020>, <NSPathControlItem: 0x600001278090>] <NSPathControlItem: 0x600001278070> a [<NSPathControlItem: 0x600001278070>, <NSPathControlItem: 0x600001278140>, <NSPathControlItem: 0x6000012780d0>] <NSPathControlItem: 0x60000124c030> a [<NSPathControlItem: 0x60000124c030>, <NSPathControlItem: 0x60000124c080>, <NSPathControlItem: 0x60000124c070>]
Topic: UI Frameworks SubTopic: AppKit Tags:
7
0
841
Feb ’23
How to install macOS 14 Sonoma or 13 Ventura on an external partition
I would like to install macOS 14 Sonoma on an external partition, but I couldn't find an installer on the developer website. It seems that it's only possible to upgrade from the System Settings, so I thought I would install Ventura first on the separate partition and then upgrade to Sonoma. I downloaded the Ventura installer from the App Store and selected the external partition during the installation, but when the Mac reboots, it just reboots into my main macOS partition. If I shut down and hold the power button pressed to select the boot partition (I have a M1 MacBook Pro 14" 2022), then nothing happens: an indeterminate progress indicator spins for a couple seconds, the partition list remains there and I can only successfully boot into my main partition again. I also tried running the installer from another macOS Ventura and macOS Monterey partition I had installed last year, but when I select the partition on which to install the new Ventura, nothing happens and I can only quit the installer. Is there a way to debug all these issues? How can I install macOS Sonoma on a separate partition without overwriting my main macOS Ventura install?
4
2
4k
Jun ’23
Creating file bookmarks doesn't work anymore on macOS 15 Sequoia
Before updating to macOS 15 Sequoia, I used to be able to create file bookmarks with this code: let openPanel = NSOpenPanel() openPanel.runModal() let url = openPanel.urls[0] do { let _ = try url.bookmarkData(options: [.withSecurityScope]) } catch { print(error) } Now I get an error Error Domain=NSCocoaErrorDomain Code=256 "Failed to retrieve app-scope key" These are the entitlements: com.apple.security.app-sandbox com.apple.security.files.user-selected.read-write com.apple.security.files.bookmarks.app-scope Strangely, my own apps continued working, after updating to macOS 15 some days ago, until a few moments ago. Then it seems that all of a sudden my existing bookmarks couldn't be resolved anymore, and no new bookmarks could be created. What could be the problem?
28
3
3.4k
Feb ’25
Xcode crashes when distributing product for App Store Connect
After building the Product Archive, the Organizer window opens, I click Distribute App. Next. Next. Next. Next. Crash. The crash happens before I'm able to export anything, so I cannot even use the Application Loader. The last message above the indeterminate progress indicator I can read before it crashes is "Packaging MyApp ...". It would be really nice if an Apple engineer could help sort this out, because I already contacted the App Store Connect support and they told me that the only way I can get help is by writing on this forum, searching the Xcode documentation, or using one of the 2 free TSIs I get each year (which I have already used). Stacktrace (I tried to paste the whole crash report, but I get an error that the message is too long and that I should click on the icon to attach a file instead, but I don't see such an icon): Process:&#9;&#9;&#9;&#9;&#9;&#9;&#9; Xcode [834] Path:&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;/Applications/Xcode.app/Contents/MacOS/Xcode Identifier:&#9;&#9;&#9;&#9;&#9;&#9;com.apple.dt.Xcode Version:&#9;&#9;&#9;&#9;&#9;&#9;&#9; 12.2 (17535) Build Info:&#9;&#9;&#9;&#9;&#9;&#9;IDEFrameworks-17535000000000000~23 (12B45b) App Item ID:&#9;&#9;&#9;&#9;&#9; 497799835 App External ID:&#9;&#9;&#9; 838360538 Code Type:&#9;&#9;&#9;&#9;&#9;&#9; X86-64 (Native) Parent Process:&#9;&#9;&#9;&#9;??? [1] Responsible:&#9;&#9;&#9;&#9;&#9; Xcode [834] User ID:&#9;&#9;&#9;&#9;&#9;&#9;&#9; 501 Date/Time:&#9;&#9;&#9;&#9;&#9;&#9; 2020-12-07 17:22:11.231 +0100 OS Version:&#9;&#9;&#9;&#9;&#9;&#9;macOS 11.0.1 (20B29) Report Version:&#9;&#9;&#9;&#9;12 Bridge OS Version:&#9;&#9; 3.0 (14Y908) Anonymous UUID:&#9;&#9;&#9;&#9;7A3F67B1-D68A-4230-40B2-B7EE13B51792 Sleep/Wake UUID:&#9;&#9;&#9; 4913FE52-7DB5-45E0-9396-EFBA2ADD0B5C Time Awake Since Boot: 47000 seconds Time Since Wake:&#9;&#9;&#9; 5900 seconds System Integrity Protection: enabled Crashed Thread:&#9;&#9;&#9;&#9;17&#9;Dispatch queue: ConcurrentQueue: -[IDEDistributionPackagingStepViewController viewDidInstall]_block_invoke Exception Type:&#9;&#9;&#9;&#9;EXC_CRASH (SIGABRT) Exception Codes:&#9;&#9;&#9; 0x0000000000000000, 0x0000000000000000 Exception Note:&#9;&#9;&#9;&#9;EXC_CORPSE_NOTIFY Application Specific Information: Possibly stale failure hints from 2020-12-07 16:21:03 +0000: &#9;0: Calling block provided by: &#9;0&#9; DVTDispatchAsync (in DVTFoundation) &#9;1&#9; __56-[IDEArchiveProductSource updateArchivesWithCompletion:]_block_invoke_2 (in IDEProducts) &#9;2&#9; DVT_CALLING_CLIENT_BLOCK (in DVTFoundation) &#9;3&#9; __DVTDispatchAsync_block_invoke (in DVTFoundation) &#9;4&#9; _dispatch_call_block_and_release (in libdispatch.dylib) &#9;5&#9; _dispatch_client_callout (in libdispatch.dylib) &#9;6&#9; _dispatch_continuation_pop (in libdispatch.dylib) &#9;7&#9; _dispatch_async_redirect_invoke (in libdispatch.dylib) &#9;8&#9; _dispatch_root_queue_drain (in libdispatch.dylib) &#9;9&#9; _dispatch_worker_thread2 (in libdispatch.dylib) 10&#9; _pthread_wqthread (in libsystem_pthread.dylib) 11&#9; start_wqthread (in libsystem_pthread.dylib) ProductBuildVersion: 12B45b ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-17518/DVTFoundation/FilePaths/DVTFilePath.m:912 Details:&#9;url should be an instance inheriting from NSURL, but it is nil Object:&#9; <DVTFilePath> Method:&#9; +filePathForFileURL: Thread:&#9; <NSThread: 0x7fa6c43458e0>{number = 4468, name = (null)} Open FDs: 115/7168 Hints:&#9; &#9;0: Calling block provided by: &#9;0&#9; DVTDispatchAsync (in DVTFoundation) &#9;1&#9; DVTAsyncPerformBlock (in DVTFoundation) &#9;2&#9; -[IDEDistributionPackagingStepViewController viewDidInstall] (in IDEKit) &#9;3&#9; -[DVTViewController _viewDidInstall] (in DVTViewControllerKit) &#9;4&#9; -[_DVTViewController_ViewLifecycleInterpositions viewDidMoveToWindow] (in DVTViewControllerKit) &#9;5&#9; -[NSView _setWindow:] (in AppKit) &#9;6&#9; -[NSView addSubview:] (in AppKit) &#9;7&#9; -[NSView setSubviews:] (in AppKit) &#9;8&#9; -[DVTBorderedView setContentView:] (in DVTUserInterfaceKit) &#9;9&#9; -[IDEDistributionAssistantWindowController setDistributionStepViewController:] (in IDEKit) 10&#9; -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] (in Foundation) 11&#9; -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] (in Foundation) 12&#9; _NSSetObjectValueAndNotify (in Foundation) 13&#9; -[IDEDistributionAssistantWindowController next:] (in IDEKit) 14&#9; __79-[IDEDistributionAutomaticSigningAssetsStepViewController _locateSigningAssets]_block_invoke_2 (in IDEKit) 15&#9; DVT_CALLING_CLIENT_BLOCK (in DVTFoundation) 16&#9; ___DVTAsyncPerformBlockOnMainRunLoop_block_invoke (in DVTFoundation) 17&#9; CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK (in CoreFoundation) 18&#9; __CFRunLoopDoBlocks (in CoreFoundation) 19&#9; __CFRunLoopRun (in CoreFoundation) 20&#9; CFRunLoopRunSpecific (in CoreFoundation) 21&#9; RunCurrentEventLoopInMode (in HIToolbox) 22&#9; ReceiveNextEventCommon (in HIToolbox) 23&#9; _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox) 24&#9; _DPSNextEvent (in AppKit) 25&#9; -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit) 26&#9; -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit) 27&#9; -[NSApplication run] (in AppKit) 28&#9; NSApplicationMain (in AppKit) 29&#9; start (in libdyld.dylib) Backtrace: &#9;0&#9; -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in IDEKit) &#9;1&#9; _DVTAssertionHandler (in DVTFoundation) &#9;2&#9; _DVTAssertionFailureHandler (in DVTFoundation) &#9;3&#9; +[DVTFilePath filePathForFileURL:] (in DVTFoundation) &#9;4&#9; -[IDEDistributionSymbolsStep runWithError:] (in IDEFoundation) &#9;5&#9; -[IDEDistributionProcessingPipeline process:] (in IDEFoundation) &#9;6&#9; -[IDEDistributionPackagingStepViewController _runPipeline] (in IDEKit) &#9;7&#9; __60-[IDEDistributionPackagingStepViewController viewDidInstall]_block_invoke_2 (in IDEKit) &#9;8&#9; DVT_CALLING_CLIENT_BLOCK (in DVTFoundation) &#9;9&#9; __DVTDispatchAsync_block_invoke (in DVTFoundation) 10&#9; _dispatch_call_block_and_release (in libdispatch.dylib) 11&#9; _dispatch_client_callout (in libdispatch.dylib) 12&#9; _dispatch_continuation_pop (in libdispatch.dylib) 13&#9; _dispatch_async_redirect_invoke (in libdispatch.dylib) 14&#9; _dispatch_root_queue_drain (in libdispatch.dylib) 15&#9; _dispatch_worker_thread2 (in libdispatch.dylib) 16&#9; _pthread_wqthread (in libsystem_pthread.dylib) 17&#9; start_wqthread (in libsystem_pthread.dylib) abort() called Application Specific Signatures: (url) != nil ...
10
0
3.4k
Apr ’21