adaptyteam / AdaptySDK-React-Native

React Native SDK for growing in-app subscriptions
https://docs.adapty.io/docs/quickstart
MIT License
122 stars 12 forks source link

iOS build fail #112

Closed elsa17z closed 6 months ago

elsa17z commented 6 months ago

Description

It appears to be related to the swift code, I have pasted the related Fastlane logs below.

Version

v2.9.5

What platforms are you seeing the problem on?

iOS

System info

› Compiling react-native-adapty Pods/react-native-adapty-sdk » react-native-adapty-sdk-dummy.m
› Compiling react-native-adapty Pods/react-native-adapty-sdk » RNAdapty.m
› Compiling react-native-adapty Pods/react-native-adapty-sdk » RNAContext.swift
› Compiling react-native-adapty Pods/react-native-adapty-sdk » RNAdapty.swift
› Compiling react-native-adapty Pods/react-native-adapty-sdk » RNAParamMap.swift

❌  (node_modules/react-native-adapty/lib/ios/RNAParamMap.swift:33:20)

  31 |         let jsonString: String = try getRequiredValue(for: key)
  32 |         
> 33 |         return try getDecodedValue<T>(for: key, jsonString: jsonString, jsonDecoder: jsonDecoder)
     |                    ^ cannot specialize a non-generic definition
  34 |     }
  35 |     
  36 |     public func getDecodedOptionalValue<T: Decodable>(for key: ParamKey, jsonDecoder: JSONDecoder) throws -> T? {

❌  (node_modules/react-native-adapty/lib/ios/RNAParamMap.swift:39:20)

  37 |         guard let jsonString: String = getOptionalValue(for: key) else { return nil }
  38 |         
> 39 |         return try getDecodedValue<T>(for: key, jsonString: jsonString, jsonDecoder: jsonDecoder)
     |                    ^ cannot specialize a non-generic definition
  40 |     }
  41 |     
  42 |     func getDecodedValue<T: Decodable>(for key: ParamKey, jsonString: String, jsonDecoder: JSONDecoder) throws -> T {
› Compiling react-native-adapty Pods/react-native-adapty-sdk » RNABridgeError.swift
› Compiling react-native-adapty Pods/react-native-adapty-sdk » RNAConstants.swift
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » Sarmiza/Sarmiza » Build Phases » 'Start Packager'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » Sarmiza/Sarmiza » Build Phases » 'Bundle React Native code and images'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸   SwiftCompile normal arm64 Compiling\ RNAParamMap.swift /Users/expo/workingdir/build/node_modules/react-native-adapty/lib/ios/RNAParamMap.swift (in target 'react-native-adapty-sdk' from project 'Pods')
▸   CompileSwift normal arm64 /Users/expo/workingdir/build/node_modules/react-native-adapty/lib/ios/RNAParamMap.swift (in target 'react-native-adapty-sdk' from project 'Pods')
▸ (2 failures)
** ARCHIVE FAILED **
The following build commands failed:
    SwiftCompile normal arm64 Compiling\ RNAParamMap.swift /Users/expo/workingdir/build/node_modules/react-native-adapty/lib/ios/RNAParamMap.swift (in target 'react-native-adapty-sdk' from project 'Pods')
    CompileSwift normal arm64 /Users/expo/workingdir/build/node_modules/react-native-adapty/lib/ios/RNAParamMap.swift (in target 'react-native-adapty-sdk' from project 'Pods')
(2 failures)

Exit status: 65
+-------------+-------------------------+
|           Build environment           |
+-------------+-------------------------+
| xcode_path  | /Applications/Xcode.app |
| gym_version | 2.211.0                 |
| sdk         | iPhoneOS16.2.sdk        |
+-------------+-------------------------+
vladd-g commented 6 months ago

@elsa17z, thank you for the report! What's your Xcode version? And could you also please update to v2.9.6?

elsa17z commented 6 months ago

I was using EAS build. I do not have a local Xcode version. Also I tried with both v2.9.5 and v2.9.6, they produced the same results.

evgenijchul commented 6 months ago

same problem XCode 14.2 react-native-adapty 2.9.6

evgenijchul commented 6 months ago

In my case only version 2.9.2 worked.

Apparently, the error is due to these changes in version 2.9.3 - https://github.com/adaptyteam/AdaptySDK-React-Native/commit/7669a626e4c3a4d54b0e6bb15356b9113882b599#diff-7d0f436e4523a6f4896c1f7ed142564a2a49f6d89112847f136505987d24dcc3

vladd-g commented 6 months ago

@evgenijchul thank you for the report! We'll debug it on Xcode 14.2

vladd-g commented 6 months ago

@elsa17z @evgenijchul could you please try v2.9.7?

evgenijchul commented 6 months ago

"react-native-adapty": "^2.9.7" The build is ok and I don't see any issues with the package working in the app. Thanks. 👍

elsa17z commented 6 months ago

Thanks for the fix