Post

Replies

Boosts

Views

Activity

Swift MacOS crash at start when using it on a Mac which is set to french language
A Swift MacOS works with no problem on Intel or ARM Macs (from 11, BigSur to 15, Sequoia) but recently I learned that is crashes when launched on a Mac which language is set to French. I'm not saying this setting is causing the issue, but is the most obvious difference observed compared to many other Macs where the App runs with no problem. The crash occurred in a MacOS intel. See excerpts from crash report below: Process: MySwiftAPP [626] Path: /Volumes/VOLUME/*/MySwiftAPP.app/Contents/MacOS/MySwiftAPP Identifier: Myinfo.MYSwiftAPP Version: X.Y.01 (1) Code Type: X86-64 (Native) Parent Process: launchd [1] User ID: 501 Date/Time: 2021-01-05 01:47:12.0578 +0100 OS Version: macOS 12.2.1 (21D62) Report Version: 12 Bridge OS Version: 3.0 (14Y910) Anonymous UUID: 3579800E-84CC-15C4-2981-320ECF2E1400 Time Awake Since Boot: 62 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4 Terminating Process: exc handler [626] Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 MySwiftAPP 0x10c6df5bb 0x10c61d000 + 796091 1 MySwiftAPP 0x10c6be4dc 0x10c61d000 + 660700 2 SwiftUI 0x7ff919a8ff0e closure #1 in AppearanceActionModifier.MergedBox.update() + 72 3 SwiftUI 0x7ff9193d2047 thunk for @escaping @callee_guaranteed () -> () + 12 4 SwiftUI 0x7ff919a91012 partial apply for thunk for @escaping @callee_guaranteed () -> () + 17 5 SwiftUI 0x7ff919bbc028 closure #1 in ViewRendererHost.render(interval:updateDisplayList:) + 2414 6 SwiftUI 0x7ff919ba9fbe ViewRendererHost.render(interval:updateDisplayList:) + 359 7 SwiftUI 0x7ff919c04d56 closure #1 in NSHostingView.layout() + 126 8 SwiftUI 0x7ff919c0dce7 partial apply for thunk for @callee_guaranteed (@guaranteed NSAnimationContext) -> () + 17 9 SwiftUI 0x7ff919c023fd thunk for @escaping @callee_guaranteed (@guaranteed NSAnimationContext) -> () + 36 10 AppKit 0x7ff8113fa152 +[NSAnimationContext runAnimationGroup:] + 55 11 SwiftUI 0x7ff919c04c8a NSHostingView.layout() + 287 12 SwiftUI 0x7ff919c0508a @objc NSHostingView.layout() + 21 13 AppKit 0x7ff811435d7f NSViewLayout + 564 14 AppKit 0x7ff811435851 -[NSView layoutSubtreeWithOldSize:] + 352 15 AppKit 0x7ff811434d68 -[NSView layoutSubtreeIfNeededAndAllowTemporaryEngine:] + 1041 16 AppKit 0x7ff811677f22 +[NSWindow windowWithContentViewController:] + 57 17 SwiftUI 0x7ff9199cd634 specialized WindowStyle.makeWindow(:) + 42 18 SwiftUI 0x7ff919b6c724 AnyWindowStyleStorage.makeWindow(:) + 26 19 SwiftUI 0x7ff91974a736 AppWindowsController.makeWindowController(:restorationID:environment:) + 2314 20 SwiftUI 0x7ff91974887d AppWindowsController.makeMainWindow(info:) + 66 21 SwiftUI 0x7ff9197487c7 AppWindowsController.makeMainWindow() + 424 22 SwiftUI 0x7ff919748067 AppWindowsController.showInitialMainWindow() + 82 23 SwiftUI 0x7ff9194e0c3e AppDelegate.applicationDidFinishLaunching(:) + 85 24 SwiftUI 0x7ff9194e0dd6 @objc AppDelegate.applicationWillFinishLaunching(_:) + 114 25 CoreFoundation 0x7ff80e9a6f23 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12 26 CoreFoundation 0x7ff80ea443f9 ___CFXRegistrationPost_block_invoke + 49 27 CoreFoundation 0x7ff80ea44376 _CFXRegistrationPost + 496 28 CoreFoundation 0x7ff80e978836 _CFXNotificationPost + 733 29 Foundation 0x7ff80f7c01be -[NSNotificationCenter postNotificationName:object:userInfo:] + 82 30 AppKit 0x7ff8113e761b -[NSApplication _postDidFinishNotification] + 305 31 AppKit 0x7ff8113e736d -[NSApplication _sendFinishLaunchingNotification] + 208 32 AppKit 0x7ff8113e4f40 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 541 33 AppKit 0x7ff8113e4b97 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 665 34 Foundation 0x7ff80f7eb194 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 308 35 Foundation 0x7ff80f7eb006 _NSAppleEventManagerGenericHandler + 80 36 AE 0x7ff815043d28 0x7ff815038000 + 48424 37 AE 0x7ff815043592 0x7ff815038000 + 46482 38 AE 0x7ff81503c9c7 aeProcessAppleEvent + 419 39 HIToolbox 0x7ff8175fdc42 AEProcessAppleEvent + 54 40 AppKit 0x7ff8113df222 DPSNextEvent + 2064 41 AppKit 0x7ff8113dd3f4 -[NSApplication(NSEvent) nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1411 42 AppKit 0x7ff8113cf919 -[NSApplication run] + 586 43 AppKit 0x7ff8113a37b7 NSApplicationMain + 816 44 SwiftUI 0x7ff9191dad3f specialized runApp(:) + 161 45 SwiftUI 0x7ff919bf9c84 runApp(:) + 164 46 SwiftUI 0x7ff91970191f static App.main() + 63 47 MySwiftAPP 0x10c6be9ae 0x10c61d000 + 661934 48 dyld 0x1134d64fe start + 462 Thread 1: 0 libsystem_pthread.dylib 0x7ff80e8e5fec start_wqthread + 0 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000200000003 rbx: 0x00007f8db5915210 rcx: 0xfffffffe00000000 rdx: 0x0000000000000003 rdi: 0x00007f8db586b178 rsi: 0x00007ff8518bbf58 rbp: 0x00007ff7b38e0080 rsp: 0x00007ff7b38e0000 r8: 0x0000000000000002 r9: 0x80000000ffffffff r10: 0xfffffffe00000000 r11: 0x0000000000000001 r12: 0x00007f8db586b170 r13: 0x00007f8db586bb40 r14: 0x00007f8db586b290 r15: 0xe800000000000000 rip: 0x000000010c6df5bb rfl: 0x0000000000010297 cr2: 0x00007ff8510288e8 Logical CPU: 0 Error Code: 0x00000000 Trap Number: 6
2
0
151
3w
screenshot for iPhone home screen
When having my iPhone connected to my Mac via USB cable, how can I take a screenshot of the home screen from a swiftUI app? I tried using libimobiledevice (idevicescreenshot) but that requires install the developer disk image. When looking for it, it turns that my Xcode (version 15.4) only provides that kind of images up to iOS 16.4. I have looked everywhere on this site, but couldn't fine the required image or otherwise, how to take the screenshot I need. Thanks!
3
0
502
Jul ’24
(Swift) TextField border contained in a view remains visible even when the view is fully overlapped by another view.
I have a ZStack that contains a VStack with 2 views (view1 and view2) and a third view (view3). So, is either that view1 and View1 are visible, or view3 is visible. This is the relevant code: ZStack { VStack { view1() View2() } if showView3 View3() } view1 and view2 are 400px in width and 200px in height, while view3 is 400 x 400 px, so that it completely overwrite view1/view2 when visible. The problem I'm trying to solve is that the border of a TextField placed in view1 is visible when showView3 is true, what should not be happening (possible glitch in swift?). To show the problem, I prepared a code sample, which shows that when view3 is active, it completely overwrites view1/view2, but still, the border of the TextField remains visible. (See screenshot below) struct TestZStackView: View { @State private var showView3 = false var body: some View { ZStack { VStack { Toggle("view3", isOn: $showView3) View1() .frame(width: 400, height: 200) .background(Color.red) .zIndex(1) View2() .frame(width: 400, height: 200) .background(Color.green) .zIndex(1) } if showView3 { View3() .frame(width: 400, height: 400) .background(Color.blue) .zIndex(2) } } } } struct View1: View { var body: some View { TextField("Enter text", text: .constant("")) .padding() .cornerRadius(5) .textFieldStyle(RoundedBorderTextFieldStyle()) .zIndex(1) } } struct View2: View { var body: some View { Color.clear } } struct View3: View { var body: some View { Color.black // (Ensure no transparency) } } zIndex() are not required, I just placed them to see if the problem get solved, but it may no difference. BTW, in the code above, the visible border disappears if the view is minimized, but that is not the case in the real app I'm working on. In the screenshots attached, it can be seen how the TextField border remains visible when view3 is active ("https://developer.apple.com/forums/content/attachment/d0e75f25-d36e-4361-af64-54252d1f2a98" "title=Screenshot 2024-05-24 at 10.06.03 PM.png;width=800;height=632")
0
0
469
May ’24
(Swift) TextField border contained in a view remains visible even when the view is fully overlapped by another view.
I have a ZStack that contains a VStack with 2 views (view1 and view2) and a third view (view3). So, is either that view1 and View1 are visible, or view3 is visible. This is the relevant code: ZStack { VStack { view1() View2() } if showView3 View3() } view1 and view2 are 400px in width and 200px in height, while view3 is 400 x 400 px, so that it completely overwrite view1/view2 when visible. The problem I'm trying to solve is that the border of a TextField placed in view1 is visible when showView3 is true, what should not be happening (possible glitch in swift?). To show the problem, I prepared a code sample, which shows that when view3 is active, it completely overwrites view1/view2, but still, the border of the TextField remains visible. (See screenshot below) struct TestZStackView: View { @State private var showView3 = false var body: some View { ZStack { VStack { Toggle("view3", isOn: $showView3) View1() .frame(width: 400, height: 200) .background(Color.red) .zIndex(1) View2() .frame(width: 400, height: 200) .background(Color.green) .zIndex(1) } if showView3 { View3() .frame(width: 400, height: 400) .background(Color.blue) .zIndex(2) } } } } struct View1: View { var body: some View { TextField("Enter text", text: .constant("")) .padding() .cornerRadius(5) .textFieldStyle(RoundedBorderTextFieldStyle()) .zIndex(1) } } struct View2: View { var body: some View { Color.clear } } struct View3: View { var body: some View { Color.black // (Ensure no transparency) } } zIndex() are not required, I just placed them to see if the problem get solved, but it may no difference. BTW, in the code above, the visible border disappears if the view is minimized, but that is not the case in the real app I'm working on. In the screenshots attached, it can be seen how the TextField border remains visible when view3 is active ("https://developer.apple.com/forums/content/attachment/d0e75f25-d36e-4361-af64-54252d1f2a98" "title=Screenshot 2024-05-24 at 10.06.03 PM.png;width=800;height=632")
0
0
518
May ’24
CommonCrypto swift module error in App
I'm working on an app that uses CommonCrypto. The app works perfectly well in my own computer, but when using the very same exe build in another computer it "quit unexpectedly". Suspecting that the issue could be on the said module, I commented out the few lines that requires the module and problem solved!. Now, as I need to use the module at the very beginning of the app, to perform certain security operations, I'm wondering what could I do to assure the module is included in the build, so the app may work in any other computer as well. This sounds weird, because I would had assumed either that the module was to be included in the build or if not, an error claiming the lack of it should have been produced. (within Xcode) what setting should I change when build the app for use in other computers, so to assure the operations that requires this module can be completed? Although this may not be relevant, I'm using swift 5, Xcode 15 (latest versions) and Sonoma 14.2.1
5
0
709
Feb ’24
SIGABRT error in Xcode just by cloning a repo for an App
I have a Swift-SwiftUI app for MacOS that runs perfectly well (meaning no errors whatsoever) on an Intel MacBook Pro (16 GB ram) but crashed immediately when trying to run on an ARM MacBook Air (8 GB ram). The error in the app is SIGTRAP (Name space Signal, Code 5 Trace/BPT trap 5 (Terminating process exc handler 1496. Although the exe was build on the intel Mac, but for both platforms (Intel & ARM) seeking to troubleshoot this issue, I tried to clone the app to further debug it using Xcode within the ARM platform, just to get into a bigger issue: As soon as the app is cloned and read, Xcode crashes with error SIGABRT (Name space Signal, Code 6 Trace/BPT trap 6 (Terminating process exc handler 1006). That happens just by attempt to load the source code of the app within Xcode, which surprises me a lot. Xcode Version on the ARM 15.0.1 (15A507) Xcode Version on the Intel 15.2 (15C500b) OS on the ARM Sonoma 14.2 OS on the Intel Sonoma 14.2.1 As this App is intended to run MacOS 12 and above, I discarded the tiny difference between OS. As to Xcode, it confuses me, as in my view, it shouldn't crash at least before the time of building the exe file... Any help to troubleshoot this will be very much appreciated! Attached: Xcode "quit unexpectedly" crash log Xcode_Cred_Log.txt
3
0
585
Feb ’24
hdiutil failure (bug?)
hdiutiul bug? When making a DMG image for the whole content of user1 profile (meaning using srcFolder = /Users/user1) using hdiutil, the program fails indicating: /Users/user1/Library/VoiceTrigger: Operation not permitted hdiutil: create failed - Operation not permitted The complete command used was: "sudo hdiutil create -srcfolder /Users/user1 -skipunreadable -format UDZO /Volumes/testdmg/test.dmg" And, of course, the user had local admin rights. I was using Sonoma 14.2.1 and a MacBook Pro (Intel T2) What I would have expected, asuming that /VoiceTrigger cannot be copied for whatever reason, would be to skip that file or folder and continue the process. Then, at the end, produce a log listing the files/folders not included and the reason for their exclusion. The fact that hdiutil just ended inmediately, looks to me as a bug. Or what else could explain the problem described?
3
1
1.1k
Feb ’24
sudo from swift MacOS app
Hi, I'm working in a MacOS Swift app that uses hdiutil and asr. Although I can send the sudo credentials and it can be read perfectly in the terminal, sometimes it appears that they are not enough to allow the program to run, throwing the following error: (asr) Failed to create source stream for replication Volume replication failed - Operation not permited This seems to be a permisions issue, because the very same code run perfectly when it is started from the terminal (szh). What would be the most practical way to overcome this issue? Any help will be highly appreciated.
4
0
786
Dec ’23
Signed-Notarized python complied exe thrown error, while the unsigned works
MyPythonExe is a compiled file coming from a python script compiled with using pyinstaller. After compiled, it was signed using codesign: codesign -s "Developer ID TTT", -o runtime -f --timestamp MyPythonExe Once signed, the exe was placed in a Zip container (exeZip), and then successfully notarized using the following: xcrun notarytool submit exeZip --keychain-profile "MyNotarProf" --wait It was accepted. Now, when try to run it, the following error was thrown (oddly, the compiled unsigned Exe runs in the same computer without any issues): /Users/admin/Downloads/MyPythonExe ; exit; admin@admins-MacBook-Air ~ % /Users/admin/Downloads/MyPythonExe ; exit; [1767] Error loading Python lib '/var/folders/80/35xy0t2n3t96b5nl5ldl24_r0000gn/T/_MEIEhOx1q/Python': dlopen: dlopen(/var/folders/80/35xy0t2n3t96b5nl5ldl24_r0000gn/T/_MEIEhOx1q/Python, 0x000A): tried: '/var/folders/80/35xy0t2n3t96b5nl5ldl24_r0000gn/T/_MEIEhOx1q/Python' (code signature in <88BFFD37-99D8-36AB-9B95-9F54B30BD667> '/private/var/folders/80/35xy0t2n3t96b5nl5ldl24_r0000gn/T/_MEIEhOx1q/Python' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/System/Volumes/Preboot/Cryptexes/OS/var/folders/80/35xy0t2n3t96b5nl5ldl24_r0000gn/T/_MEIEhOx1q/Python' (no such file), .... (+ a couple of similar errors) No, the said exe file (MyPythonExe) was signed and successfully notarized. Oddly, the very same file, but unsigned runs perfectly well (after being authorized so it can surpass Gatekeeper, of course). What could be going on here? Any hint on how to overcome this issue?
1
0
628
Sep ’23
Notarize: The staple and validate action failed! Error 73
I'm trying to staple a validation ticket to an exe file that is already notarized. The process ended with the following error: Downloaded ticket has been stored at file:///var/folders/bj/ry08v0694972s03cswkq5md80000gq/T/7f1a34f0-8628-4157-92b0-b59cebe70951.ticket. Could not remove existing ticket from file:///Users/efi-admin/Downloads/ActualSignedFile/Contents/CodeResources because an error occurred. Error Domain=NSCocoaErrorDomain Code=512 "“CodeResources” couldn’t be removed." UserInfo={NSUserStringVariant=( Remove ), NSFilePath=/Users/efi-admin/Downloads/ActualSignedFile/Contents/CodeResources, NSUnderlyingError=0x600000151e90 {Error Domain=NSPOSIXErrorDomain Code=20 "Not a directory"}} The staple and validate action failed! Error 73. The above was captured using the verbose option of the cmd... Among the response, I can see the ticket: fields = { signedTicket = { type = BYTES; value = "czhjaAEAAADxBQAALQAAADCCBe0wggL/MIICpKADAgECAghWLFU2G59vVTAKBggqhkjOPQQDAjByMSYwJAYDVQQDDB1BcHBsZSBTeXN0ZW0gSW50ZWdyYXRpb24gQ0EgNDEmMCQGA1UE.... (partial) I need help to properly understand what is this cmd doing as the issue might be permissions one. The path mentioned above under /ActualSignedFile: /ActualSignedFile/Contents/CodeResources Does not exist. Is that the cmd wants to create it? Is there any way to manually attach the ticket to the file, given the fact that is printed in verbose mode? Thanks! Any help will he highly appreciated!
7
0
1.1k
Sep ’23
Error when attempt to Notarize a compiled python code
Hello, I have a valid developer ID downloaded from Apple. I signed the code (compiled exe file for intel Macs) and put it into a ZIP, which I also signed. While signing I use timestamp and hardener option: codesign -s "$LbaDevID" -o runtime -f --timestamp $conFile3 codesign -s "$LbaDevID" -o runtime -f --timestamp $conZip3 where variable $LbaDevID represent my Dev code id (VALID, downloaded from Apple after request cert; and $conFile3 the path to the exe file and $conZip3 the path to the ZIP (just $conFile3 zipped) I attempt to notarize using the following command: xcrun notarytool submit $compZip3 --keychain-profile "TestAppNotarz" --wait the reply Log downloaded says: Invalid dev ID (which is valid) no timestamp... I corrected this error after the 1st attempt but the reply says exactly the same, even when I can see "TIMESTAMP" in the signature. The third and last error refers to the runtime, which is present but not being seen. Any help on how to troubleshoot this issue will be highly appreciated! Please point me to the relevant documentation to solve this issue...
1
0
781
Sep ’23
Signing an APP for Mac (not Xcode, Python compiled)
Hi, I'm trying to sign an App (original python compiled for MAC) and the codesign process is failing with error: The command from terminal that produced the error was: codesign --sign "$devID" $file2sign Warning: unable to build chain to self-signed root for signer "Apple Development: ..." errSecInternalComponent I have both a dev certificate (current, just downloaded a couple of days ago) and the intermediate certificates. When I run the command security find-identity -v -p codesigning I can perfectly see my dev cert, but only listed as "valid identities" nothing is listed as "matching identities" Any help will be highly appreciated!
1
0
574
Sep ’23
Signing an APP for Mac (not Xcode, Python compiled)
Hi, I'm trying to sign and app which is a python compiled exe for Mac OS (one file only). The app runs perfectly on my own mac (or some else's, but only after being admin authorized) after running codesign --sign "$devID" $file2sign I got the following error: Warning: unable to build chain to self-signed root for signer "Apple Development:..." errSecInternalComponent As per screenshot, I have both a current Dev cert and the intermediate certs installed. Any help will be highly appreciated!
3
0
997
Sep ’23