:thread: Issue Migrating a Compose iOS App to K2 ...
# compose-ios
a
🧵 Issue Migrating a Compose iOS App to K2 I have a Compose Multiplatform app for iOS and Android that I recently migrated to Kotlin 2.0. The migration went mostly as expected, but I experienced a new crash when running a small suite of Maestro tests that run on Maestro Cloud.
The tests pass when run on Android devices in Maestro Cloud and locally on an iPhone 15 simulator running iOS 17.5 (iMac M1). I cannot root cause what is causing them to crash on the iOS simulators in Maestro Cloud.
Here is the crash stack trace.
Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fff7017322a __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff701ccf7b pthread_kill + 263 2 libsystem_c.dylib 0x0000000114aa06b7 abort + 130 3 xyz.alaniz.aaron.Lightsaber 0x000000011053f59e (anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1::operator()() const + 14 4 xyz.alaniz.aaron.Lightsaber 0x000000011053f47f void (anonymous namespace)::$_0::operator()<(anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1>((anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1) + 47 5 xyz.alaniz.aaron.Lightsaber 0x000000011053f299 (anonymous namespace)::terminateWithUnhandledException(ObjHeader*) + 9 6 xyz.alaniz.aaron.Lightsaber 0x000000011053f257 (anonymous namespace)::processUnhandledException(ObjHeader*) + 55 7 xyz.alaniz.aaron.Lightsaber 0x000000011053ef59 (anonymous namespace):TerminateHandler:kotlinHandler() + 217 8 libc++abi.dylib 0x00000001135879c7 std::__terminate(void (*)()) + 8 9 libc++abi.dylib 0x000000011358a204 __cxa_rethrow + 99 10 libobjc.A.dylib 0x00000001128d9baf objc_exception_rethrow + 37 11 com.apple.CoreFoundation 0x0000000112aa8825 CFRunLoopRunSpecific + 851 12 com.apple.GraphicsServices 0x0000000117e27c8e GSEventRunModal + 139 13 com.apple.UIKitCore 0x000000012d12165a -[UIApplication _run] + 928 14 com.apple.UIKitCore 0x000000012d1262b5 UIApplicationMain + 101 15 com.apple.SwiftUI 0x0000000120443e5d closure #1 in KitRendererCommon(_:) + 196 16 com.apple.SwiftUI 0x0000000120443d97 runApp<A>(_:) + 148 17 com.apple.SwiftUI 0x000000011fe06854 static App.main() + 61 18 xyz.alaniz.aaron.Lightsaber 0x000000010f7b3cae static iOSApp.$main() + 30 19 xyz.alaniz.aaron.Lightsaber 0x000000010f7b3d49 main + 9 20 dyld_sim 0x000000011277ff21 start_sim + 10 21 dyld 0x000000011f8db310 start + 2432
At first, I thought this was some sort of architecture issue since the tests pass fine on my M1 and the Maestro cloud simulators require X86
I am not an iOS expert, but I think this
xcodebuild
argument ensures that the app is built to support x86
Copy code
ARCHS='arm64 x86_64' ONLY_ACTIVE_ARCH=NO
l
I saw a similar crash in the past if I let the phone fall asleep while a coroutine was running in a background thread (I want to say it gets a SIGABRT after 10 seconds or so). It looked very similar to what you see here.
a
Interesting. In this instance, the app crashes immediately upon launch