Hey all, I'm seeing some weird behaviour when I'm ...
# kotlin-native
s
Hey all, I'm seeing some weird behaviour when I'm trying to start an iOS application which uses a framework which is compiled using our kotlin native project. The project uses a couple of cinterops on some objectve-c frameworks:
AppCenter
,
AppCenterCrashes
,
AppCenterAnalytics
, `KeychainWrapper`; And this seems to work well at this point. However when I try to run the iOS application after interopting this framework: https://github.com/CAAPIM/iOS-MAS-Foundation (which works after modifying the imports in the header files slightly
@import SomeFramework;
->
#import <SomeFramework/SomeFramework.h>
,
#import <MASFoundation/SomeHeader.h>
->
#import "SomeHeader.h
), I get the following error when trying to boot up the application:
dyld: Library not loaded: /Library/Frameworks/MASFoundation.framework/MASFoundation
Referenced from: /Users/sandersaelmans/Library/Developer/Xcode/DerivedData/iosApp-dbelcoqoqidymygwatjnbtxoifby/Build/Products/Debug-iphonesimulator/app.framework/app
Reason: image not found
The
.def
file I'm using looks like this:
Copy code
language = Objective-C
package = com.mas
headers = MASFoundation.h

compilerOpts = \
    -Isrc/nativeInterop/cinterop/MASFoundation.framework/Headers \

linkerOpts = \
    -Fsrc/nativeInterop/cinterop \
    -framework MASFoundation \
    -framework Foundation \
    -framework UIKit
Can someone spot what I'm doing wrong here? As my other interops work perfectly...
a
Hello! Does this discussion(https://github.com/JetBrains/kotlin-native/issues/2555) seems related? I think that the problem here is that you does not include source files intto the application.
s
Seems related indeed. going to give it a shot to see if this fixes our issue
s
Dependencies don’t get bundled up in a framework. They have to be shipped along with the framework. Your Xcode build isn’t including that other framework when it is packaging up your app. You can manually drag the framework file into your project pane in Xcode to include it or better, add it as a dependency in whatever dependency manager you’re using such as cocoapods.
k
just FYI, I ran into issues when including a dependent framework w/ the cocoapods plugin
I ended up embedding both of them using Xcode
s
@Sam, but it's weird for the other dependencies as they get bundled in our generated framework, so I assumed this would also be the case for the dependency in question. But yes, embedding this dependency (the MASFoundation.framework in xcode) fixes the issue as well, but I was under the assumption that would not be necessary perse.
s
Maybe those other libraries are static libs? According to Apple, frameworks aren’t even supposed to have dependencies but that isn’t very practical.
s
Yes that seems to be the case @Sam. Alright that clears things up, thanks for your help guys 🙂