customerio / customerio-reactnative

MIT License
23 stars 11 forks source link

Swift version is missing in Podspec #249

Closed zubko closed 3 months ago

zubko commented 3 months ago

SDK version:

3.5.2

Environment: Development or Production

Development and Production

Are logs available?

Not at the moment

Describe the bug

During the upgrade to RN 73 an iOS app build issue popped up pointing to customerio-reactnative that the Swift version is not specified.

I checked other pods and many specify Swift version. So we ended up patching your podspec like this and the build issue was resolved.

diff --git a/node_modules/customerio-reactnative/customerio-reactnative-richpush.podspec b/node_modules/customerio-reactnative/customerio-reactnative-richpush.podspec
index 3099c57..a0de096 100644
--- a/node_modules/customerio-reactnative/customerio-reactnative-richpush.podspec
+++ b/node_modules/customerio-reactnative/customerio-reactnative-richpush.podspec
@@ -15,6 +15,8 @@ Pod::Spec.new do |s|
   s.platforms    = { :ios => "13.0" }
   s.source       = { :git => "https://github.com/customerio/customerio-ios.git", :tag => "#{s.version}" }

+  s.swift_version = "5.0"
+
   s.source_files = "ios/**/*.{h,m,mm,swift}"

   # s.dependency "X", "X"
diff --git a/node_modules/customerio-reactnative/customerio-reactnative.podspec b/node_modules/customerio-reactnative/customerio-reactnative.podspec
index 8a595c3..5c5fb47 100644
--- a/node_modules/customerio-reactnative/customerio-reactnative.podspec
+++ b/node_modules/customerio-reactnative/customerio-reactnative.podspec
@@ -14,6 +14,8 @@ Pod::Spec.new do |s|
   s.platforms    = { :ios => "13.0" }
   s.source       = { :git => "https://github.com/customerio/customerio-ios.git", :tag => "#{s.version}" }

+  s.swift_version = "5.0"
+
   s.source_files = "ios/**/*.{h,m,mm,swift}"

   s.dependency "React-Core"

I think specifying the Swift version won't hurt in general, right?

Feel free to close the issue if you think it's not important or if this information is already enough.

To Reproduce

Expected behavior

Screenshots

Additional context

levibostian commented 3 months ago

Thanks for sending this info to us. Sorry to hear that you are experiencing an issue with the SDK.

Could you include the commands that you ran to get the error and also include the error message you received? Extra context behind this error will be very helpful so we can reproduce the issue on our end and confirm we have resolved it.

zubko commented 3 months ago

Sorry, I'd have to undo the patch, reinstall packages, make sure all caches are clean, rebuild the app, so it's a bit lengthy process to try to reproduce that issue.

We were applying the changes from RN 71 to RN 73 mentioned by https://react-native-community.github.io/upgrade-helper/ the build command was just a regular RN iOS build and then building the app from Xcode to see the error.

I just checked which other pods in our deps have swift_version specified. Some major ones actually don't have it. But these have:

❯ rg .swift_version
expo-file-system/ios/ExpoFileSystem.podspec
18:  s.swift_version  = '5.4'

customerio-reactnative/customerio-reactnative-richpush.podspec
18:  s.swift_version = "5.0"

customerio-reactnative/customerio-reactnative.podspec
17:  s.swift_version = "5.0"

expo-keep-awake/ios/ExpoKeepAwake.podspec
18:  s.swift_version  = '5.4'

react-native-text-input-mask/react-native-text-input-mask.podspec
25:    s.swift_version = "5.0"

react-native-geolocation-service/react-native-geolocation-service.podspec
17:  s.swift_version = "5.0"

@react-native-google-signin/google-signin/expo/ios/ExpoAdapterGoogleSignIn.podspec
14:  s.swift_version  = '5.4'

expo-modules-core/ExpoModulesCore.podspec
32:  s.swift_version  = '5.4'

expo-constants/ios/EXConstants.podspec
18:  s.swift_version  = '5.4'

react-native-in-app-review/react-native-in-app-review.podspec
14:  s.swift_version = "5.0"
zubko commented 3 months ago

I found from a chat with collegue it was something like:

does not specify a Swift version and none of the targets (`Pods`) 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.

during pod install. Not at the build time, sorry.

I tried briefly now to undo the patch and reinstall, but I don't see it happening. Maybe I need to clean lock file or smth, or it comes with some combination of some versions of some dependencies. I will just keep the patch for now :)

Feel free to close the issue, but if some others report at least you'd know what is that.

levibostian commented 3 months ago

Thanks for all the great details! Greatly appreciated.

I have noted this issue internally. We will try to reproduce this on our end and go from there. In the mean time, I suggest continuing with your patch or set the swift version as the cocoapods error states: "set the SWIFT_VERSION attribute in at least one of the targets that integrate this pod". From my experience, adding blocks to your Podfile such as this one to set the Swift version on all of your pods is a convenient workaround as well.

Thanks again for sending this to us!