Xcode 11.5 (11E608c) - Swift 5.2.4 illegal instruction: 4 - ios

I'm having a problem archiving my Swift code via Xcode. I keep getting "Error. Illegal Instruction: 4"
Edit: Quick clarification - it builds and runs fine in debug for my device. It will not build for release (archive)
My first error was in one of my dependencies I built via Carthage. Tried to update all dependencies via carthage and they're all doing the same thing - "Error. Illegal Instruction: 4"
Here's the error from one on my dependencies I manually build and add in:
1. Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
0 swift 0x00000001133084ea PrintStackTraceSignalHandler(void*) + 42
1 swift 0x0000000113307cc0 SignalHandler(int) + 352
2 libsystem_platform.dylib 0x00007fff7299e5fd _sigtramp + 29
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 2372278816
4 swift 0x000000010f0507d7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 9799
5 swift 0x000000010efd1b73 main + 1283
6 libdyld.dylib 0x00007fff727a5cc9 start + 1
error: Illegal instruction: 4 (in target 'libsignal-protocol-swift iOS' from project 'libsignal-protocol-swift')
Here's another one from a different dependency built via carthage:
139 1. Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
140 0 swift 0x00000001070674ea PrintStackTraceSignalHandler(void*) + 42
141 1 swift 0x0000000107066cc0 SignalHandler(int) + 352
142 2 libsystem_platform.dylib 0x00007fff7299e5fd _sigtramp + 29
143 3 libsystem_platform.dylib 000000000000000000 _sigtramp + 2372278816
144 4 swift 0x0000000102daf7d7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void *, swift::FrontendObserver*) + 9799
145 5 swift 0x0000000102d30b73 main + 1283
146 6 libdyld.dylib 0x00007fff727a5cc9 start + 1
147 error: Illegal instruction: 4 (in target 'DynamicButton' from project 'DynamicButtonExample')
Here's it again from xcode trying to build my code:
1. Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
0 swift 0x000000010aeaf4ea PrintStackTraceSignalHandler(void*) + 42
1 swift 0x000000010aeaecc0 SignalHandler(int) + 352
2 libsystem_platform.dylib 0x00007fff7299e5fd _sigtramp + 29
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 2372278816
4 swift 0x0000000106bf77d7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 9799
5 swift 0x0000000106b78b73 main + 1283
6 libdyld.dylib 0x00007fff727a5cc9 start + 1
error: Illegal instruction: 4 (in target 'Assistant' from project 'CareApp')
I have absolutely no idea what's going on. I've restarted, cleared DerivedData, cleaned Build Folder, etc.
All the errors are exactly the same whether built via xcode or command line (carthage builds via command line)
I think it's an issue w/ Swift 5.2.4? The last time I successfully archived was 5/26/20. I'm now running Swift 5.2.4 and according to my computer it was created on 5/27/20.
Edit: I have also tried changing the optimization settings for release to "None" - same result.

Try disabling / enabling a whole module optimization or set a Custom Build Setting SWIFT_ENABLE_BATCH_MODE to NO

Related

iOS Production build (EAS, Expo) crashes directly after opening the App

I have a problem with the IOS part of my ReactNative App. The Android part works fine. When I create an development build (eas build --profile development --platform ios) there is no problem. But the preview and production builds crash directly after opening the App. The EAS build pipelines have no problems except for one message
fatal error: module 'React' in AST file '/Users/expo/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1XDLP1ZNNJOAB/React-ISQBUSD1JGEA.pcm' (imported by AST file '/Users/expo/Library/Developer/Xcode/DerivedData/MY_APP_NAME-hkvdfgprzzhwypayqwweanuiqofc/Build/Intermediates.noindex/ArchiveIntermediates/MY_APP_NAME/PrecompiledHeaders/MY_APP_NAME-Bridging-Header-swift_3BATV8FO0GBUP-clang_1XDLP1ZNNJOAB.pch') is not defined in any loaded module map file; maybe you need to load '/Users/expo/workingdir/build/ios/Pods/Headers/Public/React-Core/React/React-Core.modulemap'?
I’m not sure if the this is related to my problem because it doesn’t lead to a build failure and the dev Build has the same error message but doesn’t crash.
The App is already published to TestFlight. Therefore, I have the crash reports from the device.
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 13
…
Thread 13 name:
Thread 13 Crashed:
0 libsystem_kernel.dylib 0x00000001e5b5a200 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001f5d971ac pthread_kill + 268 (pthread.c:1670)
2 libsystem_c.dylib 0x00000001b0951ca0 abort + 180 (abort.c:118)
3 libsystem_c.dylib 0x00000001b09a8890 __assert_rtn + 272 (assert.c:96)
4 MY_APP_NAME 0x000000010487f8d4 facebook::jsc::JSCRuntime::~JSCRuntime() + 136 (JSCRuntime.cpp:393)
5 MY_APP_NAME 0x000000010487f97c ~JSCRuntime + 4 (JSCRuntime.cpp:383)
6 MY_APP_NAME 0x000000010487f97c facebook::jsc::JSCRuntime::~JSCRuntime() + 12 (JSCRuntime.cpp:383)
7 MY_APP_NAME 0x00000001046d88f0 __release_shared + 40 (shared_ptr.h:177)
8 MY_APP_NAME 0x00000001046d88f0 __release_shared + 40 (shared_ptr.h:219)
9 MY_APP_NAME 0x00000001046d88f0 std::__1::shared_ptrfacebook::react::CallInvoker::~shared_ptr() + 64 (shared_ptr.h:959)
10 MY_APP_NAME 0x000000010488cea4 ~shared_ptr + 4 (shared_ptr.h:957)
11 MY_APP_NAME 0x000000010488cea4 facebook::react::JSIExecutor::~JSIExecutor() + 268 (JSIExecutor.h:71)
12 MY_APP_NAME 0x000000010488cd90 ~JSIExecutor + 4 (JSIExecutor.h:71)
13 MY_APP_NAME 0x000000010488cd90 facebook::react::JSIExecutor::~JSIExecutor() + 12 (JSIExecutor.h:71)
14 MY_APP_NAME 0x00000001047c9d64 operator() + 20 (function.h:505)
15 MY_APP_NAME 0x00000001047c9d64 operator() + 20 (function.h:1182)
16 MY_APP_NAME 0x00000001047c9d64 facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 32 (RCTCxxUtils.mm:74)
17 MY_APP_NAME 0x00000001047d61ec facebook::react::RCTMessageThread::tryFunc(std::__1::function<void ()> const&) + 24 (RCTMessageThread.mm:69)
18 MY_APP_NAME 0x00000001047d694c operator() + 20 (function.h:505)
19 MY_APP_NAME 0x00000001047d694c operator() + 20 (function.h:1182)
20 MY_APP_NAME 0x00000001047d694c operator() + 24 (RCTMessageThread.mm:61)
21 MY_APP_NAME 0x00000001047d694c __invoke<(lambda at /Users/expo/workingdir/build/node_modules/react-native/React/CxxBridge/RCTMessageThread.mm:60:12) &> + 24 (type_traits:3918)
22 MY_APP_NAME 0x00000001047d694c __call<(lambda at /Users/expo/workingdir/build/node_modules/react-native/React/CxxBridge/RCTMessageThread.mm:60:12) &> + 24 (invoke.h:61)
23 MY_APP_NAME 0x00000001047d694c operator() + 24 (function.h:178)
24 MY_APP_NAME 0x00000001047d694c std::__1::__function::__func<facebook::react::RCTMessageThread::runSync(std::__1::function<void ()>)::$_0, std::__1::allocator<facebook::react::RCTMessageThread::runSync(std::__1::function<void ()>… + 40 (function.h:352)
25 MY_APP_NAME 0x00000001047d5fa0 operator() + 20 (function.h:505)
26 MY_APP_NAME 0x00000001047d5fa0 operator() + 20 (function.h:1182)
27 MY_APP_NAME 0x00000001047d5fa0 invocation function for block in facebook::react::RCTMessageThread::runAsync(std::__1::function<void ()>) + 44 (RCTMessageThread.mm:45)
28 CoreFoundation 0x00000001a94ab924 CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 28 (CFRunLoop.c:1822)
29 CoreFoundation 0x00000001a95140ac __CFRunLoopDoBlocks + 368 (CFRunLoop.c:1864)
30 CoreFoundation 0x00000001a94e4508 __CFRunLoopRun + 2452 (CFRunLoop.c:3218)
31 CoreFoundation 0x00000001a94e91e4 CFRunLoopRunSpecific + 612 (CFRunLoop.c:3390)
32 MY_APP_NAME 0x00000001047bf398 +[RCTCxxBridge runRunLoop] + 264 (RCTCxxBridge.mm:378)
33 Foundation 0x00000001a3912ce8 NSThread__start + 716 (NSThread.m:968)
34 libsystem_pthread.dylib 0x00000001f5d916cc _pthread_start + 148 (pthread.c:893)
35 libsystem_pthread.dylib 0x00000001f5d90ba4 thread_start + 8
…
Expo: 45
Workflow: bare
eas-cli: 2.5.1
During search I tried to replace a lot of code in the AppDelegate.mm I found for this problem. Also from a freshly created and ejected Expo 45 example project.
When replacing almost the entire code from the App.tsx with a simple Text it works.
Furthermore, expo run:ios and npx expo start --no-dev --minify have also no problems.
I hope some of you have an idea how to solve this. I’m stuck on this Issue for some time now. If you need additional information, ask in the comments.
The problem was solved by enabling hermes in the Podfile with :hermes_enabled => true

DTDeviceKit: Could not start house arrest service for app identifier XXX

I'm using Xcode 7.3.1 and executing XCTest via the command-line on my device, "iPhone 1", which is an iPhone 6 running iOS 9.3.5:
xcodebuild \
-scheme Todo \
-project Todo.xcodeproj \
-destination "platform=iOS,name=iPhone 1"\
clean build test
The build succeeded, however it failed after compiling the test files:
2016-09-13 14:51:32.604 xcodebuild[79689:2064116] DTDeviceKit: Could not start house arrest service for app identifier com.example.Todo [Error Domain=com.apple.dtdevicekit Code=-402653093 "Too many instances of this service are already running." UserInfo={NSLocalizedFailureReason=Too many instances of this service are already running., com.apple.dtdevicekit.stacktrace=(
0 DTDeviceKitBase 0x000000010fead3cb DTDKCreateNSError + 113
1 DTDeviceKitBase 0x000000010feadb09 DTDK_AMDErrorToNSError + 791
2 DTDeviceKitBase 0x000000010febf2f5 __70-[DTDKRemoteDeviceConnection startHouseArrestServiceForAppIdentifier:]_block_invoke + 100
3 DTDeviceKitBase 0x000000010febe1d1 __48-[DTDKRemoteDeviceConnection futureWithSession:]_block_invoke_4 + 22
4 DTDeviceKitBase 0x000000010feb0317 __DTDKExecuteInSession_block_invoke + 38
5 DTDeviceKitBase 0x000000010feaf940 __DTDKExecuteWithConnection_block_invoke_2 + 477
6 DTDeviceKitBase 0x000000010feaf73c __DTDKExecuteWithConnection_block_invoke + 107
7 libdispatch.dylib 0x00007fff99bda40b _dispatch_client_callout + 8
8 libdispatch.dylib 0x00007fff99bdb9f2 _dispatch_barrier_sync_f_invoke + 74
9 DVTFoundation 0x0000000106400bef DVTDispatchBarrierSync + 206
10 DVTFoundation 0x00000001063dd59b -[DVTDispatchLock performLockedBlock:] + 116
11 DTDeviceKitBase 0x000000010feaf646 DTDKExecuteWithConnection + 223
12 DTDeviceKitBase 0x000000010feb02a1 DTDKExecuteInSession + 121
13 DTDeviceKitBase 0x000000010febe108 __48-[DTDKRemoteDeviceConnection futureWithSession:]_block_invoke_3 + 117
14 DVTFoundation 0x00000001063fff4b __DVTDispatchAsync_block_invoke + 827
15 libdispatch.dylib 0x00007fff99be593d _dispatch_call_block_and_release + 12
16 libdispatch.dylib 0x00007fff99bda40b _dispatch_client_callout + 8
17 libdispatch.dylib 0x00007fff99becbd7 _dispatch_async_redirect_invoke + 1733
18 libdispatch.dylib 0x00007fff99bda40b _dispatch_client_callout + 8
19 libdispatch.dylib 0x00007fff99bde29b _dispatch_root_queue_drain + 1890
20 libdispatch.dylib 0x00007fff99bddb00 _dispatch_worker_thread3 + 91
21 libsystem_pthread.dylib 0x00007fff9b5d94de _pthread_wqthread + 1129
22 libsystem_pthread.dylib 0x00007fff9b5d7341 start_wqthread + 13
), NSLocalizedRecoverySuggestion=Too many instances of this service are already running., NSLocalizedDescription=Too many instances of this service are already running.}]
2016-09-13 14:51:32.918 xcodebuild[79689:2063388] Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}
Running the tests in Xcode did not succeed either. And it always fails with the errors described in these posts:
dyld: could not load inserted library
Xcode 7.0 XCTest dyld: could not load inserted library IDEBundleInjection
I've tried the solutions suggested in the posts (i.e. fix provisioning profile and code signing), but it did not help. Has anyone faced similar problems?
I was trying to find out if DTDeviceKit was running on my machine, but it did not. My next suspicion was that it could be running on the phone.
After rebooting my phone, it works.
I filed a technical support ticket with apple. Turns out it's a bug which affects 32 bit devices. So if you test on a 64 bit device you won't have this issue.

Xcode 7.3.1 crashes on MacOS Sierra Beta 5

Note: I have been using Xcode7.x with MacOS Sierra since Beta 1 or 2. It's worked just fine. I haven't touched Xcode 8 on this machine.
Since beta 5, suddenly I can't do anything with Xcode 7. I start it up and open my workspace and as soon as I change the view to another file or project or assets or anything, it crashes with the following error:
Process: Xcode [869]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 7.3.1 (10188.1)
Build Info: IDEFrameworks-10188001000000000~3
App Item ID: 497799835
App External ID: 817226719
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [869]
User ID: 501
Date/Time: 2016-08-11 11:21:13.167 -0700
OS Version: Mac OS X 10.12 (16A286a)
Report Version: 12
Anonymous UUID: BC13DBAB-4D04-3E83-CF4A-4F1FFB581BCE
Time Awake Since Boot: 250 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000020
Exception Note: EXC_CORPSE_NOTIFY
VM Regions Near 0x20:
-->
__TEXT 000000010ce99000-000000010ce9d000 [ 16K] r-x/rwx SM=COW /Applications/Xcode.app/Contents/MacOS/Xcode
Application Specific Information:
ProductBuildVersion: 7D1014
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff8ce08a31 objc_retain + 33
1 com.apple.dt.DVTKit 0x000000010d73838a __38-[DVTSourceTextView setTextContainer:]_block_invoke + 28
2 com.apple.dt.DVTFoundation 0x000000010d0e5e88 __95-[NSObject(DVTObservingConvenience) _dvt_newObserverForKeyPath:options:owner:withHandlerBlock:]_block_invoke + 91
3 com.apple.dt.DVTFoundation 0x000000010d0e4d2e __73-[DVTObservingBlockToken observeValueForKeyPath:ofObject:change:context:]_block_invoke.195 + 83
4 com.apple.dt.DVTFoundation 0x000000010d00b911 DVTInvokeWithStrongOwnership + 75
5 com.apple.dt.DVTFoundation 0x000000010d0e48c6 -[DVTObservingBlockToken observeValueForKeyPath:ofObject:change:context:] + 336
6 com.apple.Foundation 0x00007fff7a0e9dbd NSKeyValueNotifyObserver + 350
7 com.apple.Foundation 0x00007fff7a0e9654 NSKeyValueDidChange + 486
8 com.apple.Foundation 0x00007fff7a2282d7 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:usingBlock:] + 944
9 com.apple.Foundation 0x00007fff7a0ad3c9 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 60
10 com.apple.Foundation 0x00007fff7a115c3b _NSSetObjectValueAndNotify + 261
11 com.apple.CoreFoundation 0x00007fff786cfde7 -[NSArray makeObjectsPerformSelector:withObject:] + 279
12 com.apple.UIFoundation 0x00007fff8ac9282b -[NSLayoutManager setTextStorage:] + 912
13 com.apple.dt.DVTKit 0x000000010d6ad401 -[DVTFoldingLayoutManager setTextStorage:] + 154
14 com.apple.UIFoundation 0x00007fff8ace6515 -[NSTextStorage dealloc] + 117
15 com.apple.dt.DVTKit 0x000000010d64647e -[DVTTextStorage dealloc] + 911
16 com.apple.Foundation 0x00007fff7a11dcbd NSKVODeallocate + 94
17 com.apple.AppKit 0x00007fff76627281 -[NSTextView dealloc] + 813
18 com.apple.dt.DVTKit 0x000000010d803030 -[DVTCompletingTextView dealloc] + 120
19 com.apple.AppKit 0x00007fff76427a96 -[NSTextView release] + 464
20 libsystem_blocks.dylib 0x00007fff8d728952 _Block_release + 102
21 libsystem_blocks.dylib 0x00007fff8d728952 _Block_release + 102
22 libdispatch.dylib 0x00007fff8d6d9c6f _dispatch_source_handler_dispose + 23
23 libdispatch.dylib 0x00007fff8d6c9da3 _dispatch_source_cancel_callout + 90
24 libdispatch.dylib 0x00007fff8d6c0a6e _dispatch_source_invoke + 1512
25 libdispatch.dylib 0x00007fff8d6cba0f _dispatch_main_queue_callback_4CF + 505
26 com.apple.CoreFoundation 0x00007fff7870bd39 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
27 com.apple.CoreFoundation 0x00007fff786cd15d __CFRunLoopRun + 2205
28 com.apple.CoreFoundation 0x00007fff786cc664 CFRunLoopRunSpecific + 420
29 com.apple.HIToolbox 0x00007fff77c6ef7c RunCurrentEventLoopInMode + 240
30 com.apple.HIToolbox 0x00007fff77c6edb1 ReceiveNextEventCommon + 432
31 com.apple.HIToolbox 0x00007fff77c6ebe6 _BlockUntilNextEventMatchingListInModeWithFilter + 71
32 com.apple.AppKit 0x00007fff76365c41 _DPSNextEvent + 1093
33 com.apple.AppKit 0x00007fff76a75693 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1637
34 com.apple.dt.DVTKit 0x000000010d601439 -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 396
35 com.apple.AppKit 0x00007fff7635a610 -[NSApplication run] + 926
36 com.apple.AppKit 0x00007fff763250e2 NSApplicationMain + 1237
37 com.apple.dt.Xcode 0x000000010ce9a39b 0x10ce99000 + 5019
38 libdyld.dylib 0x00007fff8d6f4255 start + 1
Anyone else come across this in beta 5?
From macOS Sierra beta 5 release notes:
Xcode
Xcode 7.3.1 is not compatible with macOS Sierra.
Workaround: Use Xcode 8.0 beta or later when running on macOS Sierra.
It should be possible to use swift 2.3 in xcode 8. From beta 6 notes:
For developers on macOS Sierra it is recommended that you move to Xcode 8. You can continue to develop with the Swift 2.x release with the included Swift 2.3 compiler until you are ready to migrate to Swift 3. Xcode 7.3.1 is not supported on macOS Sierra. (27224895)
With a stable Mac OS X Sierra (v10.12), Xcode 7.3.1 started to work on third launch. Everything seems to work fine, no problems with emulator or anything!
Don't lose hope if Xcode doesn't work on the first launch :)
I've been able to recreate this same particular issue (DVTSourceTextView setTextContainer) in Mac OS Sierra (non beta) for xcode 7.3.1. Oddly, I found it somehow attributed to my Cocoapods implementation. I was able to open up the project but not the workspace. I deleted my workspace and Pods directory then did a pod install to redo it.
The issue was fixed then. Lost a couple days of work researching, hoping this helps someone.

Xcode crashes on launch

I am developing an Application for iOS and I changed nothing in the Application. But at a restart of my Mac, Xcode crashes every time.
Don't know if this is important, but my spotlight can't find any applications and also when I open the finder and using the shortcut cmd + shift + H I see a white window.
Xcode isn't starting anymore and throws this error:
Process: Xcode [1346]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 7.2 (9548)
Build Info: IDEFrameworks-9548000000000000~7
App Item ID: 497799835
App External ID: 814662604
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [1346]
Date/Time: 2015-12-24 11:01:44.753 +0100
OS Version: Mac OS X 10.11.2 (15C50)
Report Version: 11
Time Awake Since Boot: 4000 seconds
System Integrity Protection: enabled
Crashed Thread: 4 Dispatch queue: DVTFilePathEventWatcher - event queue
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
VM Regions Near 0:
-->
__TEXT 0000000108a5a000-0000000108a5e000 [ 16K] r-x/rwx SM=COW /Applications/Xcode.app/Contents/MacOS/Xcode
Application Specific Information:
ProductBuildVersion: 7C68
Thread 0:: Dispatch queue: DVTFilePath cache derivation lock for key DVTFilePathKey_SortedDirectoryContents
0 libobjc.A.dylib 0x00007fff8df27aa0 search_method_list(method_list_t const*, objc_selector*) + 2
1 libobjc.A.dylib 0x00007fff8df28d76 lookUpImpOrForward + 413
2 libobjc.A.dylib 0x00007fff8df22591 objc_msgSend + 209
3 com.apple.dt.DVTFoundation 0x0000000108a741f8 -[DVTFileSystemVNode addCachedEntriesFromDictionary:] + 215
4 com.apple.dt.DVTFoundation 0x0000000108bd2e2d __33-[DVTFilePath cachedValueForKey:]_block_invoke549 + 245
5 libdispatch.dylib 0x00007fff9fcbd33f _dispatch_client_callout + 8
6 libdispatch.dylib 0x00007fff9fcbe926 _dispatch_barrier_sync_f_invoke + 74
7 com.apple.dt.DVTFoundation 0x0000000108cd1005 DVTDispatchBarrierSync + 62
8 com.apple.dt.DVTFoundation 0x0000000108a69627 -[DVTDispatchLock performLockedBlock:] + 116
9 com.apple.dt.DVTFoundation 0x0000000108a715b0 -[DVTFilePath cachedValueForKey:] + 1802
10 com.apple.dt.DVTFoundation 0x0000000108a70afc -[DVTToolchainRegistry scanSearchPathAndRegisterToolchains:] + 563
11 com.apple.dt.IDEFoundation 0x00000001097d1a66 IDEInitialize + 655
12 com.apple.dt.IDEKit 0x0000000109ecdf7c -[IDEApplicationController applicationWillFinishLaunching:] + 708
13 com.apple.CoreFoundation 0x00007fffa18fa70c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
14 com.apple.CoreFoundation 0x00007fffa18fa67f ___CFXRegistrationPost_block_invoke + 63
15 com.apple.CoreFoundation 0x00007fffa18f9d47 _CFXRegistrationPost + 407
16 com.apple.CoreFoundation 0x00007fffa18f9ab2 ___CFXNotificationPost_block_invoke + 50
17 com.apple.CoreFoundation 0x00007fffa18f3d42 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1922
18 com.apple.CoreFoundation 0x00007fffa17e2145 _CFXNotificationPost + 693
19 com.apple.Foundation 0x00007fff9ef36921 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
20 com.apple.dt.DVTFoundation 0x0000000108c6cf55 -[NSNotificationCenter(DVTNSNotificationCenterAdditions) _dvt_postNotificationName:object:userInfo:] + 698
21 com.apple.AppKit 0x00007fff9db412c2 -[NSApplication finishLaunching] + 354
22 com.apple.dt.DVTKit 0x0000000109275f62 -[DVTApplication finishLaunching] + 149
23 com.apple.AppKit 0x00007fff9db40e05 -[NSApplication run] + 231
24 com.apple.AppKit 0x00007fff9dac3520 NSApplicationMain + 1176
25 libdyld.dylib 0x00007fff9a8605ad start + 1
Could this be an issue due to Permissions conflicts?
ANSWER:
After I changed the rights from my OSX-Drive to everyone can write&read. Everything worked. But I knew that this is a temporary solution, so I decided to reinstall my MAC and everything was fine.
Delete ~/Library/Developer/Xcode/DerivedData by running this command in terminal:
rm -r ~/Library/Developer/XCode/DerivedData
If that doesnt work, At this point and with given info, all I could recommend to delete and reinstall Xcode.
If the delete of ~/Library/Developer/Xcode/DerivedData is not working for you, try this steps to remove xcuserdata:
open a Finder window and navigate to your project
right-click on the .xcodeproj OR .xcworkspace file
select Show Package Contents
a new window appears
delete a folder called xcuserdata
I had one where i selected a file that was quite large which crashed xcode when it tried to parse it. Then when i restarted it somehow it got set to load that file on start. Only way i saw was to temporarily rename the file that it was trying to load at start so it would load empty.
I'll recommend deleting xcuserdata: folder from both of your .xcodeproj & .xcworkspace file (open with Show Package Contents) and try again.
I hope this will work.
Ensure there are no issues with your SPM packages/dependencies.
This is simply another suggestion. I just spent some time debugging this on a fairly popular open source project.
My Xcode first crashed when I updated a SPM package, so I was fairly certain it was an issue with one of the future commits in that package or a SPM bug. I subscribe to Occam's Razor, so I started going through the changes in the commits.
After some time, I found a duplicate Swift Playground page delcaration in contents.xcplayground. I removed that single line, pushed the PR, and everything worked fine after that.
To be able to reopen the project:
Open project.pbxproj in your code editor of choice (e.g. vi, nano, emacs, atom, code).
Remove the offending package or packages from the /* Begin XCRemoteSwiftPackageReference section */ and /* Begin XCSwiftPackageProductDependency section */ sections.
Save the file and Xcode should now open.
Again, if your Xcode is immediately crashing when opening a project (and you last updated/auto-updated a SPM package) go through your packages.

App With CocoaPods Distribution AdHoc Crash (uses keychain and keychain returns null)

xcode swift project runs with couple cocoapods frameworks like MQTTClient, uses keychain and keychain returns null,works well on xcode but crashes on distribution adhoc, I have done everything re installing cocoapods, adding the .a files of cocoa to build phases, adding library search path, i'm not figuring out why keychain keeps returning nil and why it keeps crashing on Distribution adhoc, here is the crash report
Class MQTTManager start function accesses the cocopods MQTTClient.a
And accesses the keychain
Incident Identifier: 4B4B005E-7BC2-487D-9A8A-FEEAB4967CF4
CrashReporter Key: TODO
Hardware Model: iPhone7,2
Process: testProj [494]
Path: /private/var/mobile/Containers/Bundle/Application /3A3B094D-FACB-49B9-BE84-5EA6F8F40D2A/testProj.app/testProj
Identifier: com.test.testProj
Version: 205
Code Type: ARM-64
Parent Process: launchd [1]
Date/Time: 2015-03-13 14:28:20 +0000
OS Version: iPhone OS 8.2 (12D508)
Report Version: 104
Exception Type: SIGTRAP
Exception Codes: #0 at 0x1002559e4
Crashed Thread: 0
Thread 0 Crashed:
0 testProj 0x00000001002559e4 _TFC9testProj11MQTTManager5startfS0_FT_T_ + 2000
1 testProj 0x000000010014a134 _TFFC9testProj16SignInController9checkUserFS0_FT_T_U_FTCSo12NSURLRequestGSqCSo17NSHTTPURLResponse_GSqPSs9AnyObject__GSqCSo7NSError__T_ + 3848
2 testProj 0x0000000100244b68 _TFFFC9testProj7Request8responseFDS0_FT5queueGSqCSo8NSObject_10serializerFTCSo12NSURLRequestGSqCSo17NSHTTPURLResponse_GSqCSo6NSData__TGSqPSs9AnyObject__GSqCSo7NSError__17completionHandlerFTS2_GSqS3__GSqPS5___GSqS6___T__DS0_U_FT_T_U_FT_T_ + 640
3 libdispatch.dylib 0x0000000198631994 <redacted> + 24
4 libdispatch.dylib 0x0000000198631954 <redacted> + 16
5 libdispatch.dylib 0x000000019863620c _dispatch_main_queue_callback_4CF + 1608
6 CoreFoundation 0x0000000186fc22ec <redacted> + 12
7 CoreFoundation 0x0000000186fc0394 <redacted> + 1492
8 CoreFoundation 0x0000000186eed1f4 CFRunLoopRunSpecific + 396
9 GraphicsServices 0x000000019030f6fc GSEventRunModal + 168
10 UIKit 0x000000018b87e10c UIApplicationMain + 1488
11 testProj 0x00000001001c0c60 main + 116
12 libdyld.dylib 0x000000019865ea08 <redacted> + 4
Found a solution here
http://dasdev.de/2014/12/04/assessing-the-keychain-in-swift/
I found that its not connected to cocoapods libraries of any searchpaths
I had to change the swift compiler optimization flags to [NONE], took me 2 days to found an answer, and thats it, it works fine

Resources