kotlin-hands-on / kmp-networking-and-data-storage

Other
255 stars 70 forks source link

iOS build fails #3

Closed ln-12 closed 3 years ago

ln-12 commented 4 years ago

First of all I wanna state out that the idea behind KMM is awesome! Unfortunately I ran into an issue when trying it out.

Using the final branch, I cannot build the iOS app. After building the project in Android Studio 4.1 RC 3, switching to XCode 12.0 and hitting Product -> Build, I get the error No such module 'shared' inside ContentView.swift. When doing the same on a newly generated KMM application, this works fine. I noticed, that Android Studio does not generate the xcode-frameworks folder, so it's no surprise that XCode can't find it.

Moreover, I cannot run the iOS simulator from Android Studio. The build fails with:

ld: warning: ignoring file /Users/****/kmm/shared/build/xcode-frameworks/shared.framework/shared, building for iOS Simulator-arm64 but attempting to link with file built for iOS Simulator-x86_64
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_SharedGreeting", referenced from:
      objc-class-ref in ContentView.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED ** 

Am I missing something?

rasheedsulayman commented 4 years ago

I am experiencing the same issue.

KaterinaPetrova commented 3 years ago

Hey, @ln-12! Thanks for reporting the issue. Are you sure that you are using the final branch? This problem may appear on the master branch because on the first step there is no code in iOS source set, so there is no generated .framework file.

And also have you tried to clean the Xcode project or delete the build folder of the KMM shared module? (kmm-networking-and-data-storage/shared/build)?