moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

bundle with identifier xxx.MR not found

Open qdsfdhvh opened this issue 3 years ago • 5 comments
trafficstars

I tried to run it on ios but get the following error:

Uncaught Kotlin exception: kotlin.IllegalArgumentException: bundle with identifier com.seiko.imageloader.demo.MR not found
    at 0   Compose-ImageLoader                 0x10138554d        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 93 
    at 1   Compose-ImageLoader                 0x10137e8e9        kfun:kotlin.Exception#<init>(kotlin.String?){} + 89 
    at 2   Compose-ImageLoader                 0x10137ea69        kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 89 
    at 3   Compose-ImageLoader                 0x10137edc9        kfun:kotlin.IllegalArgumentException#<init>(kotlin.String?){} + 89 
    at 4   Compose-ImageLoader                 0x101e8db11        kfun:dev.icerock.moko.resources.utils#loadableBundle__at__platform.Foundation.NSBundle.Companion(kotlin.String){}platform.Foundation.NSBundle + 4321 
    at 5   Compose-ImageLoader                 0x101f1ec16        kfun:com.seiko.imageloader.demo.MR.<init>$lambda-0#internal + 150 
    at 6   Compose-ImageLoader                 0x101f1eccb        kfun:com.seiko.imageloader.demo.MR.$<init>$lambda-0$FUNCTION_REFERENCE$4.invoke#internal + 123 
    at 7   Compose-ImageLoader                 0x10139998b        kfun:kotlin.native.concurrent.SynchronizedLazyImpl#<get-value>(){}1:0 + 1083 
    at 8   Compose-ImageLoader                 0x101f1e426        kfun:com.seiko.imageloader.demo.MR.<get-bundle>#internal + 230 
    at 9   Compose-ImageLoader                 0x101f1e66c        kfun:com.seiko.imageloader.demo.MR.assets#<init>(){} + 412 
    at 10  Compose-ImageLoader                 0x101f9bbab        _ZN6kotlin2mm13InitSingletonEPNS0_10ThreadDataEPP9ObjHeaderPK8TypeInfoPFvS4_ES5_ + 1387 
    at 11  Compose-ImageLoader                 0x101f2926a        kfun:com.seiko.imageloader.demo.$ImageList$<anonymous>_5$<anonymous>_6COROUTINE$0.invokeSuspend#internal + 3498 
    at 12  Compose-ImageLoader                 0x10138a296        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 758 
    at 13  Compose-ImageLoader                 0x101548896        kfun:kotlinx.coroutines.DispatchedTask#run(){} + 3318 
    at 14  Compose-ImageLoader                 0x101574327        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.dispatch$<anonymous>_3#internal + 103 
    at 15  Compose-ImageLoader                 0x1015743af        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.$dispatch$<anonymous>_3$FUNCTION_REFERENCE$1266.invoke#internal + 63 
    at 16  Compose-ImageLoader                 0x10157448f        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.$dispatch$<anonymous>_3$FUNCTION_REFERENCE$1266.$<bridge-UNN>invoke(){}#internal + 63 
    at 17  Compose-ImageLoader                 0x101575470        _6f72672e6a6574627261696e732e6b6f746c696e783a6b6f746c696e782d636f726f7574696e65732d636f7265_knbridge636 + 240 
    at 18  libdispatch.dylib                   0x103bd9815        _dispatch_call_block_and_release + 11 
    at 19  libdispatch.dylib                   0x103bdaa5a        _dispatch_client_callout + 7 
    at 20  libdispatch.dylib                   0x103bdce62        _dispatch_queue_override_invoke + 1039 
    at 21  libdispatch.dylib                   0x103becba1        _dispatch_root_queue_drain + 418 
    at 22  libdispatch.dylib                   0x103bed64d        _dispatch_worker_thread2 + 195 
    at 23  libsystem_pthread.dylib             0x7fff701c7f89     _pthread_wqthread + 255 
    at 24  libsystem_pthread.dylib             0x7fff701c6f56     start_wqthread + 14 
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/seiko/Library/Developer/Xcode/DerivedData/Compose_ImageLoader-gbgdshzowlvdkofkeytafelurjyd/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMTLCapture.dylib DYLD_FRAMEWORK_PATH=/Users/seiko/Library/Developer/Xcode/DerivedData/Compose_ImageLoader-gbgdshzowlvdkofkeytafelurjyd/Build/Products/Debug-iphonesimulator

this is my demo: https://github.com/qdsfdhvh/compose-imageloader/tree/feature/moko

qdsfdhvh avatar Jul 01 '22 05:07 qdsfdhvh

@Alex009 I was able to get my ios compose ui app to run with moko-resources. I had to use this task to copy the bundle.

But that was not enough. In the generated xcode project, I then had to add the bundle to Build Phases -> Copy Bundle Resources That will include the bundle in the ios app. However, if you launch as is you will get an invalid CFBundleVersion error. To fix that I had to open the Info.plist inside the bundle and change the CFBundleVersion from 1 -> 1.0.0.

After that the ios app properly recognized MR resources from my shared kotlin module

If you have any ideas how to automate the adding of the bundle to Build Phases -> Copy Bundle Resources that would be helpful.

Also I think the CFBundleVersion issue could be resolved if changed here: https://github.com/icerockdev/moko-resources/blob/master/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/apple/LoadableBundle.kt

Edit. Upon further inspection. I think the CFBundleVersion from 1 -> 1.0.0 issue is only a problem when running on simulator, not a real device.

luca992 avatar Aug 13 '22 00:08 luca992

@luca992 where is the bundle located?

ArTemmey avatar Aug 19 '22 00:08 ArTemmey

@luca992 where is the bundle located?

build/bin/{target}

luca992 avatar Aug 19 '22 00:08 luca992

@luca992 I have the following structure there: bin/uikitX64/debugExecutable with falling-balls-mpp.kexe.dSYM and falling-balls-mpp.kexe inside it. I've tried to add the whole uikitX64 dir and its contents separately, with "create groups" and "create folder references" options. Nothing worked :( Still see bundle not found error.

ArTemmey avatar Aug 19 '22 01:08 ArTemmey

Тоже такая ошибка лезет..Uncaught Kotlin exception: kotlin.IllegalArgumentException: bundle with identifier ...MR not found

ArturMazay avatar Sep 06 '22 17:09 ArturMazay

Is there any solution to this problem by now? I am also having the same problem with a Compose multiplatform project which is structured like the above mentioned falling-balls-mpp project where the xcode project is constantly regenerated so that I can't add anything to it manually.

mipastgt avatar Nov 04 '22 14:11 mipastgt

I am having this problem as well (without compose).

Function doesn't have or inherit @Throws annotation and thus exception isn't propagated from Kotlin to Objective-C/Swift as NSError.
It is considered unexpected and unhandled instead. Program will be terminated.
Uncaught Kotlin exception: kotlin.IllegalArgumentException: bundle with identifier com.apps.iosApp.MR not found
    at 0   iosApp                              0x102d5e4d7        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 123 
    at 1   iosApp                              0x102d57ba3        kfun:kotlin.Exception#<init>(kotlin.String?){} + 119 
    at 2   iosApp                              0x102d57d1b        kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 119 
    at 3   iosApp                              0x102d580e7        kfun:kotlin.IllegalArgumentException#<init>(kotlin.String?){} + 119 
    at 4   iosApp                              0x102df8f67        kfun:dev.icerock.moko.resources.utils#loadableBundle__at__platform.Foundation.NSBundle.Companion(kotlin.String){}platform.Foundation.NSBundle + 3331 

saravr avatar Dec 22 '22 04:12 saravr

same issue here .. hope someone is taking a look on this

Nailik avatar Jan 26 '23 18:01 Nailik

My project is using cocoapods framework and I'm solving the problem by adding Run Script in Build Phases with the script in readme, then move Run Script before Compile Source

erwinkaaa avatar Jan 30 '23 08:01 erwinkaaa

@erwinkaaa Are you able to access resources in the iOS project?

arowierzbowskispoton avatar Feb 03 '23 11:02 arowierzbowskispoton

@arowierzbowskispoton yes I can

erwinkaaa avatar Feb 06 '23 07:02 erwinkaaa

@erwinkaaa Are you accessing them from KMM (like shared or resources) module or directly from the app (swift)?

arowierzbowskispoton avatar Feb 06 '23 08:02 arowierzbowskispoton

I can successfully access the resources in iOS project but got the same error after running the app.

Uncaught Kotlin exception: kotlin.IllegalArgumentException: bundle with identifier com.organtis.shared.MR not found
    at 0   Organtis                            0x1036b6416        kfun:dev.icerock.moko.resources.utils#loadableBundle__at__platform.Foundation.NSBundle.Companion(kotlin.String){}platform.Foundation.NSBundle + 3734 
    at 1   Organtis                            0x1036c202c        kfun:com.organtis.shared.OR.$<init>$lambda$0$FUNCTION_REFERENCE$1.invoke#internal + 124 
    at 2   Organtis                            0x10341b8fb        kfun:kotlin.native.concurrent.SynchronizedLazyImpl#<get-value>(){}1:0 + 1211 
    at 3   Organtis                            0x1036b973a        kfun:com.organtis.shared.OR.<get-bundle>#internal + 186 
    at 4   Organtis                            0x1036b9a1a        kfun:com.organtis.shared.OR.strings#<init>(){} + 714 
    at 5   Organtis                            0x103890d8f        objc2kotlin.2810 + 991 
    at 6   Organtis                            0x1030ef7da        $sSo15SharedORStringsCABycfCTO + 26 
    at 7   Organtis                            0x1030eece8        $s10HomeModule0A9PresenterC11prepareApps33_6E3CB8679A12B9E99F21727465D80D59LLyyF + 3912 

tekinalper avatar Feb 25 '23 22:02 tekinalper

I also soft it by add Build Phases with README in my Project, guys can refer to the follow picture for configuration. image

qdsfdhvh avatar Jun 04 '23 11:06 qdsfdhvh