Closed kansson closed 1 year ago
Have been looking for similar problems and found this https://github.com/JetBrains/kotlin-native/issues/3059#issuecomment-501699248. Maybe this could help with solving this problem?
Hi! Thanks for reporting this. I just checked with the sample project which has working SwiftUI previews. Could you possibly share some more details about your project setup?
Sure here is a reproduction https://github.com/hanssonduck/XcodePreview. Now when I'm looking at it maybe this package isn't the problem.
What I did was delete the default Xcode project and created a new Xcode multiplatform project and then linking it with Kotlin following this https://kotlinlang.org/docs/multiplatform-mobile-integrate-in-existing-app.html#connect-the-framework-to-your-ios-project. Seems that maybe I did something wrong here. New to Xcode and Swift development so not sure, maybe you can see something. You can compare the two commits to see the working and broken states.
TLDR: Generated new multiplatform Xcode project that broke the preview.
Hi again, got it working with this solution https://stackoverflow.com/a/71214308/10055887. Not sure what the problem is but it works and I'm happy. If you do find something of interest feel free to mention it nonetheless.
Hello, awesome project!
I'm using this package together with
NativeCoroutines
and everything works great on both platforms but not in the Xcode preview. The preview will not load at all and crashes with this error log.Error Log
------------------------------------- Translated Report (Full Report Below) ------------------------------------- Incident Identifier: 7471A224-E102-4E3A-8665-6BC7B1FD3D4A CrashReporter Key: 8B36B5A8-1965-D9C2-C099-610507FD1EF2 Hardware Model: MacBookAir10,1 Process: ios [2276] Path: /Users/USER/Library/Developer/Xcode/UserData/Previews/Simulator Devices/3D6F16D8-2B4B-47FC-A471-DED791F64349/data/Containers/Bundle/Application/8492D742-B9D7-4F60-AB2F-CD4098EE7443/ios.app/ios Identifier: duck.hansson.odd.ios Version: 1.0 (1) Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd_sim [72630] Coalition: com.apple.CoreSimulator.SimDevice.3D6F16D8-2B4B-47FC-A471-DED791F64349 [16757] Responsible Process: SimulatorTrampoline [64885] Date/Time: 2023-05-17 20:01:11.3450 +0200 Launch Time: 2023-05-17 20:01:11.1845 +0200 OS Version: macOS 13.3.1 (22E261) Release Type: User Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Triggered by Thread: 0 Kernel Triage: VM - (arg = 0x0) pmap_enter retried due to resource shortage VM - (arg = 0x0) pmap_enter retried due to resource shortage VM - (arg = 0x0) pmap_enter retried due to resource shortage VM - (arg = 0x0) pmap_enter retried due to resource shortage VM - (arg = 0x0) pmap_enter retried due to resource shortage Thread 0 Crashed:: Dispatch queue: BSXPCCnx:com.apple.dt.xcode-previews.systemservices (BSCnx:client:com.apple.dt.uv.agent-preview-nonui-service) 0 libsystem_kernel.dylib 0x1b17e3fa8 __pthread_kill + 8 1 libsystem_pthread.dylib 0x1b183812c pthread_kill + 256 2 libsystem_c.dylib 0x18012873c abort + 124 3 Shared 0x103910cec konan::abort() + 12 4 Shared 0x10393ded8 (anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1::operator()() const + 16 5 Shared 0x10393dcf0 void (anonymous namespace)::$_0::operator()<(anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1>((anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1) + 80 6 Shared 0x10393da00 (anonymous namespace)::terminateWithUnhandledException(ObjHeader*) + 12 7 Shared 0x10393d9bc (anonymous namespace)::processUnhandledException(ObjHeader*) + 64 8 Shared 0x1039532b4 kotlin::ProcessUnhandledException(ObjHeader*) + 188 9 Shared 0x103955e2c Kotlin_ObjCExport_trapOnUndeclaredException + 36 10 Shared 0x1036e5b14 objc2kotlin_kfun:duck.hansson.odd.shared.module.SharedModule#The code that crashed the preview is this view binding of a view model. If it's removed the preview works.
I'm using Koin for dependency injection and I've confirmed it's not the issue as this code works in the preview.