razorpay / react-native-razorpay

React Native wrapper for Razorpay's mobile SDKs
https://www.npmjs.com/package/react-native-razorpay
MIT License
122 stars 107 forks source link

Error With Apple M1 Chip | React Native TS Template | #375

Closed ImAbhishekTomar closed 2 years ago

ImAbhishekTomar commented 2 years ago

Repo - https://github.com/ImAbhishekTomar/RNRazorpay/tree/fix-rz-pay

Build 1 : npx react-native run-ios

➜  RNRazorpay git:(master) ✗ yarn ios
yarn run v1.22.17
warning ../package.json: No license field
$ react-native run-ios
info Found Xcode workspace "RNRazorpay.xcworkspace"
info Building (using "xcodebuild -workspace RNRazorpay.xcworkspace -configuration Debug -scheme RNRazorpay -destination id=097D2A74-B672-4B9A-AED2-8A303ADA1ACF")
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening RNRazorpay.xcworkspace.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace RNRazorpay.xcworkspace -configuration Debug -scheme RNRazorpay -destination id=097D2A74-B672-4B9A-AED2-8A303ADA1ACF

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

note: Using new build system
note: Planning
Analyze workspace

Create build description
Build description signature: bf4eb1a35488d7d03cf101bacca964ef
Build description path: /Users/abhishektomar/Library/Developer/Xcode/DerivedData/RNRazorpay-duhunnbmzkqxchcfezcdaayffqvp/Build/Intermediates.noindex/XCBuildData/bf4eb1a35488d7d03cf101bacca964ef-desc.xcbuild

note: Build preparation complete
note: Building targets in parallel
/Users/abhishektomar/Desktop/root/apps/RNRazorpay/ios/RNRazorpay.xcodeproj: error: The linked library 'libPods-RNRazorpay.a' is missing one or more architectures required by this target: x86_64. (in target 'RNRazorpay' from project 'RNRazorpay')

** BUILD FAILED **

Build 2 : npx react-native run-ios

The following build commands failed:
        CompileC /Users/abhishektomar/Library/Developer/Xcode/DerivedData/RNRazorpay-duhunnbmzkqxchcfezcdaayffqvp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-razorpay.build/Objects-normal/arm64/RazorpayCheckout.o /Users/abhishektomar/Desktop/root/apps/RNRazorpay/node_modules/react-native-razorpay/ios/RazorpayCheckout.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'react-native-razorpay' from project 'Pods')
(1 failure)
ImAbhishekTomar commented 2 years ago

Issue Resolved.

Here is the solution - https://github.com/ImAbhishekTomar/RNRazorpay/commit/6853db3219feae9310e417aa906984e31479085d#diff-281ded35b124f5160d0a57e47e521ee6f49f233933e091a0d33f3fd42a74abc8

Need to add few lines in pod file

installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end

Razore docs : https://razorpay.com/docs/payment-gateway/react-native-integration/standard/ios/#m1-macbook-changes