I’m having an issue with CocoaPod integration. I h...
# multiplatform
p
I’m having an issue with CocoaPod integration. I have created a new KMM project from Android Studio “New Project/KMM Application” Then added a basic CocoaPod dependency on AFNetworking just as described in the tutorial https://kotlinlang.org/docs/native-cocoapods.html#add-a-dependency-on-a-pod-library-from-the-cocoapods-repository Then I have updated Platform class with AFNetworking usage.
import platform.UIKit.UIDevice
import cocoapods.AFNetworking.*
actual class Platform actual constructor() {
actual val platform: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion +
" " + AFNetworkingReachabilityNotificationStatusItem
}
After that I’m getting linkage error while trying to build an iOS app.
Undefined symbols for architecture x86_64:
"_AFNetworkingReachabilityNotificationStatusItem", referenced from:
_cocoapods_AFNetworking_AFNetworkingReachabilityNotificationStatusItem_getter_wrapper12 in shared(result.o)
ld: symbol(s) not found for architecture x86_64
How to solve this error? My configuration Android Studio Arctic Fox 2020.3.1 Patch 3 Kotlin 1.6.0 XCode 13 ruby 2.6.0p0 (had to downgrade because of a problem with cocoapods-generate install) cocoapods 1.11.2 cocoapods-generate 2.2.2 Mac OS Monterey 12.0.1
1
v
Hi, Please try gradle sync in AS and then build ios app in Xcode again
k
after adding pod dependency you should call
pod install
from ios project dir or sync project via AS it’s standard pod mechanism
p
Unfortunately sync in AS didn’t help. However,
pod install
in iOS project directory did the trick. The app build and runs just fine. Thank you so much, guys!
v
Great that manual
pod install
helped but ideally gradle sync should do it for you. Created a YT ticket to track this https://youtrack.jetbrains.com/issue/KT-49771
👍 2