khairil.ushan

    khairil.ushan

    7 months ago
    I created a KMM application using Android Studio, I am able to run the Android and iOS app. Then I created a macOS app that I want to make it depends on the Kotlin Module as well. I tried to copy the build phase from iOS to the macOS project but fail with this error
    Showing All Messages
    > Task :mylibrary:embedAndSignAppleFrameworkForXcode FAILED
    
    /Users/username/Library/Developer/Xcode/DerivedData/MyApp-macOS-bcjmruopehjfwogkwonshzamndam/Build/Products/Debug/MyApp-macOS.app/Contents/Frameworks/MyLibrary.framework/MyLibrary: replacing existing signature
    
    /Users/username/Library/Developer/Xcode/DerivedData/MyApp-macOS-bcjmruopehjfwogkwonshzamndam/Build/Products/Debug/MyApp-macOS.app/Contents/Frameworks/MyLibrary.framework/MyLibrary: bundle format is ambiguous (could be app or framework)
    
    
    
    FAILURE: Build failed with an exception.
    
    
    
    * What went wrong:
    
    Execution failed for task ':mylibrary:embedAndSignAppleFrameworkForXcode'.
    
    > Process 'command 'codesign'' finished with non-zero exit value 1
    Is there anything extra that I should do to link the framework to the macOS app properly?
    r

    Rick Clephas

    7 months ago
    Hi! There is an issue with the frameworks losing their symlinks, which results in a codesigning failure. This will be fixed in Kotlin 1.6.20-M1: https://youtrack.jetbrains.com/issue/KT-48594 I believe you can also disable the codesigning in Xcode as long as you are not on a M1 mac:https://stackoverflow.com/questions/31039513/how-can-i-skip-code-signing-for-development-builds-in-xcode
    khairil.ushan

    khairil.ushan

    7 months ago
    Thanks for the info, unfortunately Im developing using M1 mac. Would you recommend a way for this kind of usecase ?
    r

    Rick Clephas

    7 months ago
    Ah right well unfortunately there isn’t another workaround (that I know of). If you don’t mind updating to 1.6.20-M1 then there is actually no need for a workaround 🙂. Besides that you could try using CocoaPods instead of the embedAndSign task, but I also had some issues with CocoaPods and a macOS app on M1 (had to run it in Rosetta).
    khairil.ushan

    khairil.ushan

    7 months ago
    ah i see. thanks so much. will try the 1.6.20-m1 probably.
    Landry Norris

    Landry Norris

    7 months ago
    You could also use https://github.com/ge-org/multiplatform-swiftpackage and set up the xcode run script to use a swift package. I’ve started using this for a library I’m working on for work. I believe Swift Packages support macOS.