Closed aaronhanan closed 1 year ago
Hey @aaronhanan, which version of Xcode are you using? There is a known issue with Xcode 14.3 and React Native, as described here. This has been resolved as of React Native 0.71.6, but there are some workarounds described in that GitHub thread - or using Xcode 14.2 as an alternative. Could you confirm if this is the issue you are seeing?
We are looking to raise our support for the latest version of React Native in our SDK in a future release, but let us know if the above helps resolve your issue.
Hi @jerielng, I'm currently using Xcode 14.3 and have tried the workaround, but I'm still getting the same error. I've also tried using Xcode 14.2, no luck. I have not tried updating react-native, Ill give that a shot.
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
Watchman: 2023.04.17.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.12.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
Android SDK:
API Levels: 29, 30, 31, 32, 33
Build Tools: 28.0.3, 29.0.2, 29.0.3, 31.0.0, 32.0.0, 34.0.0
System Images: android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7935034
Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
Languages:
Java: 11.0.19 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^17.0.2 => 17.0.2
react-native: 0.68.7 => 0.68.7
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Thanks for sharing your system details! We'll try to dig deeper from our end to see if this is a unique issue, but do let us know if upgrading your version of React Native resolves the issue.
To confirm, you mentioned that you are able to run the sample project successfully, but the compile error occurs when trying to import the SDK into your own project? Are there any setup differences between the two projects you are using?
Updated RN to 0.69.11 but im still getting the same issue. I did the same steps for both projects, running it though CLI or Xcode. The issue only happens right after I add the @braze/react-native-sdk
package into my project and build. I will try to provide you reproduction steps.
Hi @jerielng, I am able to consistently reproduce it with these configurations and building it through Xcode:
package.json:
{
"name": "brazetest",
"version": "1.0.0",
"private": true,
"scripts": {},
"dependencies": {
"@braze/react-native-sdk": "^5.0.0",
"react": "^17.0.2",
"react-native": "0.68.7",
"react-native-permissions": "^3.0.0"
},
"resolutions": {
"@types/react-native": "0.68.6",
"@types/react": "^17.0.2"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native-community/eslint-config": "^3.2.0",
"@tsconfig/react-native": "^2.0.2",
"@types/jest": "^29.2.1",
"@types/react": "^18.0.24",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.2.1",
"eslint": "^8.19.0",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.73.7",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"typescript": "4.8.4"
},
"volta": {
"node": "16.18.0",
"yarn": "1.22.18"
}
}
Podfile:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '13.0'
$RNFirebaseAsStaticFramework = true
target 'brazeTest' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly"
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
def pod.build_type;
# Uncomment the line corresponding to your CocoaPods version
Pod::BuildType.static_library # >= 1.9
# Pod::Target::BuildType.static_library # < 1.9
end
end
end
end
# Our Pods
pod 'SSZipArchive'
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'brazeTestTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
Thanks @aaronhanan, we'll take a look at the setup you've provided and keep you updated here on what insights we're able to find!
Hi @jerielng, any updates on this? Were you able to reproduce this?
Hi @aaronhanan, looking at your Podfile, it looks like you are using the use_frameworks!
directive. Our library is not meant to be installed with this directive, as it contains statically linked dependencies. It looks like this pod install
issue is silenced by the pre_install
step you have in your Podfile, so I imagine that is why you are able to succeed during the install step. For further insight on this, you may refer to this comment here.
Can you try changing your use_frameworks
to use_frameworks! :linkage => :static
instead and seeing if that resolves your issue?
Thanks @jerielng! I didnt realize braze sdk was statically linked. I added this:
installer.pod_targets.each do |pod|
if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-') || pod.name.start_with?('braze')
def pod.build_type;
# Uncomment the line corresponding to your CocoaPods version
Pod::BuildType.static_library # >= 1.9
# Pod::Target::BuildType.static_library # < 1.9
end
end
end
This solved the issue for me! Closing this.
Which Platforms?
iOS
Which React Native Version?
0.68.7
Which @braze/react-native-sdk SDK version?
5.0.0
Repro Rate
100% of the time
Steps To Reproduce
Example:
yarn add @braze/react-native-sdk
Expected Behavior
ios should build
Actual Incorrect Behavior
ios doesn't build
Verbose Logs
Additional Information
Hello,
I have tried other versions of
@braze/react-native-sdk
but still no luck. Getting the same error and am unable to build the ios app. Android is working great with the same version.On xcode, Im getting
braze-react-native-sdk
undefined symbol
error andLinker command failed with exit code 1 (use -v to see invocation)
.I ran the example project and was able to build on ios just fine. Any ideas?
Thanks.