Hi, This object is failing while being wrapped `&...
# touchlab-tools
y
Hi, This object is failing while being wrapped
> Task :shared:linkDebugFrameworkIosX64 FAILED
, to working this out I have two option or change object into class or use
@SuspendInterop.Disabled
on suspend function
refreshFailed
. Is Is bug or I am doing something wrong ?
Copy code
object TokenRefreshErrorHandler {
    var dispatch: (suspend (action: Action) -> Unit)? = null

    suspend fun refreshFailed(ex: SessionExpiredError) = withContext(Dispatchers.Main) {
        dispatch?.invoke(SessionAction.SessionExpired(ex))
    }
}
f
Hi! This is likely a bug. I’ll try if I can reproduce it.
what version of SKIE do you use? (I cannot reproduce the issue in the latest version and the generated code looks different from what you have, so it’s likely that updating SKIE will resolve the issue)
y
I'm using
id("co.touchlab.skie") _version_ "0.6.1"
f
ok in that case it has to be something else
I assume that your module is named “shared”, can you try temporarily renaming it to something else? for example put this in the gradle build script where you have SKIE (you might have a similar code there already, in which case just change the names):
Copy code
kotlin {
    targets.withType<KotlinNativeTarget> {
        binaries {
            framework {
                isStatic = true
                baseName = "Shared2"
                freeCompilerArgs = freeCompilerArgs + listOf("-Xbinary=bundleId=Shared2")
            }
        }
    }
}
I think I know what is the issue - it’s indeed the framework name. The name
shared
collides with the static property generated by Kotlin compiler for each object. Unfortunately, there is no easy way we can solve that on our end - SKIE requires to have a framework name that is not used for any other public declarations that can create collisions. (I think the best we can do is to document this and throw a warning / error so that the issue is easier to spot).
actually, SKIE already renames classes that create this collision, we could in theory rename the “shared” property, but I’m not sure what solution here would be better
in your case you will probably just need to rename the module to something else (even
Shared
would be enough to solve this issue)