-
Notifications
You must be signed in to change notification settings - Fork 566
iOS : Unexpected receiver type: kotlin.native.internal.NSMutableArrayAsKMutableList, Release only #3343
Comments
I did revert to Kotlin 1.3.41 and the issue is not present when building in release mode. |
Looks like a bug in devirtualization, please provide complete reproducer and we'll fix it. |
It seems like I have the same issue: The cause of exception was that line: With this line the issue is not reproduced: |
I was able to reproduce bug with:
|
Workaround without exception.
|
Hello everyone! Thanks for those snippets, they are making a lot of sense for understanding the issue. |
I just wanted to say that I have a similar issue.
Somehow the issue is in this line: private fun getUnreadItems(): List<UnreadItems> {
val unreadItems = runBlocking { unreadItems() } ?: return emptyList()
return unreadItems.items.map {
UnreadItems(
publisher = it.origin.title,
blogTitle = it.title,
href = it.alternate.firstOrNull()?.href ?: ""
)
}
} If I convert the items to a - return unreadItems.items.map {
+ return unreadItems.items.toMutableList().map { I tried to create a reproducer of this issue but without success. @artdfel I could send you my project via Slack DM. Please write me (@StefMa) or give me your name :) |
I have a similar probem in my project, when calling the following lines: val paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, true)
val documentsDirectory = paths[0] as String In debug it's not an issue, but when building for release I get the following error:
So far the workaround is to change the first line as follows: val paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, true).toMutableList() I'm still trying to reproduce the error in a smaller project but fail too. |
Fixed in master and will be fixed in the upcoming 1.3.70 release. |
(cherry picked from commit d97f00f)
(cherry picked from commit d97f00f)
(cherry picked from commit d97f00f)
(cherry picked from commit d97f00f)
Hello,
I am using Kotlin Native 1.3.50 to build a multiplatform mobile app, using cocoapods plugin.
The app runs fine in debug mode, but the following code crashes in release build :
The classes are generated by cinterop and snapshot.documents is a NSArray bridged as a List<*>. It seems that any method call on this list will trigger the following RuntimeException
(I tried to replace .map by a .forEach(), and even .size() throws an error)
Tell me if you need more information.
Right now I need to force the framework in debug, even when the app is built in release, which is unfortunately the only way to publish my app right now. If you have any workaround, I'll be happy to hear it.
Thanks
The text was updated successfully, but these errors were encountered: