Hi Everyone, I work on multiplatform library for i...
# multiplatform
h
Hi Everyone, I work on multiplatform library for iOS/Android. I use the following external dependency in my lib https://github.com/icerockdev/moko-socket-io. And when I build iOS framework, I export this dependency to framework as mentioned in the documentation here. That's what I have in gradle:
Copy code
ios()
iosArm64 {
    binaries.framework(iosFrameworkName) {
        isStatic = true
        export("dev.icerock.moko:socket-io:0.4.0")
        transitiveExport = true
    }
}
iosX64 {
    binaries.framework(iosFrameworkName) {
        isStatic = true
        export("dev.icerock.moko:socket-io:0.4.0")
        transitiveExport = true
    }
}
...
sourceSets {
        val commonMain by getting {
            dependencies {
                api("dev.icerock.moko:socket-io:0.4.0")
            }
        }
}
The size of the final binary doesn't change, it doesn't matter if I add an export or not. And when I add a created framework to my iOS app, I get an error that xcode cannot find this external dependency ( you can see the error message on the attached screenshot). Did anyone face that kind of issue? Do you have any idea what went wrong? Thank you for help and your time!
a
did you add cocoapods mokoSocketIo ?
h
Hi Aleksey, it's cool that you answered me here. I have more questions now, and probably you are the best person who could answer it) So yes, I did add cocoapods in gradle. And actually the problem was that I imported wrong binary. Gradle generates framework binary with pods in separate file. And this binary has mokoSocketIo dependency. But I have another problem now. I build my kmm library as framework for iOS, this framework contains mokoSocketIo. Then I import it to flutter project in Xcode as Embedded library. And xcode could find mokoSocketIo on compilation stage. But then on runtime I receive: Library not loaded in runtime - mokoSocketIo. Probably , it's because I don't have Podfile in my kmm library. To be honest, I don't know if I should create podfile if I don't have .xcodeproj in my kmm library. I am new in iOS development. Hope I could describe my problem clear :)
a
you should use cocoapods in you xcode application project to add dependency at mokoSocketIo. without it your application not receive dynamic library mokoSocketIo and will failed in runtime as you got
h
Oh it's pity. Does it mean that everyone who will use my library should add mokoSocketIo to their podfile?
a
yes. it's described in readme
h
Yes, I've seen it in readme. It wasn't clear to me enough what to do in case of library. Anyway, thank you for your help!
@alex009, sorry that ping you directly. I have one more question regarding moko socket io. I was able to run my application. And I've got an error in iOS masked and rsv data is not currently supported. code=1002, type=protocolError On Android everything works fine. I am not sure if it's better to create an issue in github, or you could answer here.
a
this error not from moko code. i think it's from https://github.com/socketio/socket.io-client-swift
h
Hi Aleksey, thank you for the response. Yes, you are right, the problem is on swift client side. They fixed it on 16.0 version https://github.com/socketio/socket.io-client-swift/releases/tag/v16.0.1. It would be great if you could update mokoSocketIo to use the latest version of the swift socket io client. Otherwise, we need to downgrade our server side.
a
you can add in your project podfile this dependency to new release and it should work
if in this release not changed api
d
@alex009 hi how to fix that I should fork the library and update the version , Can you upgrade it and publish new release
👍 1
a
hi. if you tell about socket.io swift dependency - just change version in your own podfile, not inside library
also you can send PR with fix and i will publish new release.
d
why when I install the pods the library install the socket.io swift dependency
I'm trying to create a pull request, but you're using the Swift Socket.IO library only in the sample module. The project shouldn't depend on the library, but since it's pulled from Git, the sample module gets included as well. For that it is installed from moko socket io
d
Yes I update it but I need to fix some issues the socket engine api change I think
203 Views