Hello guys, i'm in the proccess to develop app wit...
# multiplatform
r
Hello guys, i'm in the proccess to develop app with kmm and my app need to use aws amplify library, i have done the integrating for the android version and now i'm stuck in integrating aws amplify library with ios, i use the cocoapods integration, if i'm only import pod with just amplify, it finish pod install with success, but when i try to add pod for awscognitoauthplugin it always error on and it says i need to set swift version attribute, can someone help me to tell how to set the swift_version attribute on build gradle file? Here's the error message.
Executing of 'pod install' failed with code 1 and message:
Analyzing dependencies
Downloading dependencies
Installing AWSAuthCore (2.29.1)
Installing AWSCognitoIdentityProvider (2.29.1)
Installing AWSCognitoIdentityProviderASF (2.29.1)
Installing AWSCore (2.29.1)
Installing AWSMobileClient (2.29.1)
Installing AWSPluginsCore (1.28.4)
Installing AmplifyPlugins (1.28.4)
[!] Unable to determine Swift version for the following pods:
`-
AWSMobileClient
does not specify a Swift version and none of the targets (
ios
) integrating it have the
SWIFT_VERSION
attribute set. Please contact the author or set the
SWIFT_VERSION
attribute in at least one of the targets that integrate this pod.`
k
According to https://stackoverflow.com/questions/58691345/unable-to-determine-swift-version-for-the-following-pod-error It's because your project is very old and never set Swift version in the project. Try to create one new swift file in the project. Xcode will automatically set Swift version in project build settings. Then you can
pod install
again and it will be solved.
a
@Kamil Kalisz you can’t do this here because Xcode project in question is generated by CocoaPods plugin
k
Oh, sorry I thought that project was generated and we can open it and set swift version, and after that we can add this dependency.
a
@Reza Muttaqien unfortunately I don’t see a good solution here. This probably worth reporting to AWSMobileClient podspec maintainers (because they have swift files in their sources and don’t specify
spec.swift_version
). To make it work you can add
ENV['SWIFT_VERSION'] = '5'
to generated Podfile but current way to do it is very ugly (see https://youtrack.jetbrains.com/issue/KT-54161/Support-adding-extra-code-to-generated-Podfile-from-the-Kotlin-gradle-plugin). Or you can try to fork podspec repo to modify this podspec manually, but I haven’t tried this myself so don’t know how feasible it is.
b
Did anyone manage to solve this? Do we have any better solution to one that is mentioned in this thread with creating custom task for podGenIOS gradle task?
a
b
I am just now testing this approach. I meant to write about it after I tried it out. Thank you @a-dd 🙌
🙏 1
393 Views