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

Unknown type name 'RazorpayCheckout'; did you mean 'RNRazorpayCheckout'? #331

Closed sivaLeo closed 3 years ago

sivaLeo commented 3 years ago

Look at the screenshot.

"react-native": "0.61.5", "react-native-razorpay": "2.2.4",

Screenshots

Screenshot 2021-05-11 at 11 08 15 PM
sivaLeo commented 3 years ago

what i missed

Nautiyalsachin commented 3 years ago

Hi @sivaLeo, try removing the plugin and adding it again, also recommend you to run pod update from the iOS folder.

vineeth-vk11 commented 3 years ago

@Nautiyalsachin I am also facing the same issue from yesterday. Tried uninstalling and reinstalling react-native-razorpay and I have also tried running pod update but the issue is still there

"react-native" : 0.63.4 "react-native-razorpay": "2.2.4"

Build configuration - Debug - Build successful Build configuration - Release - Build Failed

sivaLeo commented 3 years ago

@Nautiyalsachin i tried already npm uninstall --save react-native-razorpay cd ios && pod install && cd .. npm install --save react-native-razorpay cd ios && pod install && cd ..

------Not working-----

vineeth-vk11 commented 3 years ago

@sivaLeo are you using the latest M1 mac with latest xcode?

sivaLeo commented 3 years ago

@vineeth-vk11 i'm using MacBook Pro MacOS 10.15.6 Xcode Version 12.4 (12D4e)

vineeth-vk11 commented 3 years ago

@sivaLeo I am able to build the code successfully in debug build configuration but the build fails in production build configuration. Are you able to build in debug config?

sivaLeo commented 3 years ago

I got stuck in debug mode

Nautiyalsachin commented 3 years ago

@vineeth-vk11 Try changing Build Active Architecture Only to Yes for both release and debug. Also see our FAQs for more details.

Nautiyalsachin commented 3 years ago

@sivaLeo Please try above FAQs to validate your integration, also please try running our Sample App, let us know if you still face any issues.

sivaLeo commented 3 years ago

Debug Mode already set as yes

vineeth-vk11 commented 3 years ago

@Nautiyalsachin I have tried setting Build Active Architecture Only to Yes in both Debug and Release but the issue it still there.

sivaLeo commented 3 years ago

@Nautiyalsachin Still i'm getting that error bro

Nautiyalsachin commented 3 years ago

@vineeth-vk11 Are you using M1 powered MacBook?

@sivaLeo can you tell me the razorpay pod version from podfile.lock. You can find this file inside iOS folder.

vineeth-vk11 commented 3 years ago

@Nautiyalsachin yes I am using a M1 powered MacBook

Nautiyalsachin commented 3 years ago

@vineeth-vk11 I would recommend you to use Rosetta 2. For more details see this link.

vineeth-vk11 commented 3 years ago

@Nautiyalsachin I have tried by enabling Rosetta 2 already but it did not solve the issue, I have compared the build settings of the sample app and my app, they are also the same. Any other suggestions?

I was able to build the sample app with the versions given in package.json but when I upgraded the react native and react versions in the sample app, I got some erros which I am still trying to resolve to see if I can regenerate the error on the sample using my current versions of react native and react.

I have Xcode 12.5, can downgrading my xcode solve the isse?

vineeth-vk11 commented 3 years ago

@Nautiyalsachin I am able to regenerate the error with SampleProject on my Mac now.

Here are the list of changes I have made to the code to get the error

package.json dependencies upgraded to following versions "react": "16.13.1", "react-native": "~0.63.4", "react-native-razorpay": "^2.2.4"

Podfile.lock razorpay pod version updated to 1.1.12

I have completely changed the pod file to this

//Podfile Start

require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' require_relative '../node_modules/react-native/scripts/react_native_pods'

platform :ios, '10.0'

target 'SampleProject' do

config = use_native_modules! use_react_native!(:path => config["reactNativePath"])

end

//Podfile End

With these I was able to get the error.

can you tell me if changing the pod file is causing the issues?

sivaLeo commented 3 years ago

hey @Nautiyalsachin @vineeth-vk11, Now its working This is my side issue. before I manually linked the razor-pay. So the configuration lines are still in pb.xproj file even i uninstall the razor-pay in my project. so that im unlink the razor pay then uninstall the plugin.

npx react-native unlink react-native-razorpay
npm uninstall --save react-native-razorpay

Then im searching with key razor-pay in vs-code global search its shows two lines of code in project.pbxproj. so i delete the line of codes and run pod install it remove previous razorpay-pod. previous time i'm not seeing that line "removing razorpay-pod" - its explaining what i missed.

------ Thank you for your time to debug with me ------

Nautiyalsachin commented 3 years ago

@sivaLeo Glad that you are able to solve it on your own, I would also recommend you to use auto-linking, so that you don't face these issue in future.

@vineeth-vk11 Can you share the errors here?

vineeth-vk11 commented 3 years ago

@Nautiyalsachin I am attaching a screenshot of the errors I got in the SampleProject, they are the same in my project too

Screenshot 2021-05-13 at 9 29 25 AM

I made changes to the Podfile and Package.json in the SampleProject to get the issue. I also ran pod update.

Screenshot 2021-05-13 at 9 32 00 AM Screenshot 2021-05-13 at 9 32 31 AM
Nautiyalsachin commented 3 years ago

@vineeth-vk11 Can you try creating a sample app from scratch and then try to integrate react-native-razorpay plugin, let me know if you face any issues there. I would recommend following the auto-linking process. Let me know how it goes for you. Thanks.

vineeth-vk11 commented 3 years ago

@Nautiyalsachin I have created a new project using expo. Following are the steps I followed

  1. expo init RazorpayTest
  2. expo eject
  3. npm install --save react-native-razorpay
  4. cd ios
  5. pod install
  6. pod update

After this I opened the project in xcode Build in debug configuration is successful After changing the build configuration to release I got the same errors

I have tried setting the Build Active Architecture to True in both Debug and Release.

My expo version is 4.4.4

Do you think the issue is with ejecting from expo?

Edit :

I also tried with react native CLI. I created a new project and installed the react-native-razorpay but got the same workers.

Nautiyalsachin commented 3 years ago

@vineeth-vk11 Oh got the issue, you can't integrate our app with the expo. As we are using some native functionality here and that is not supported by the expo framework. For more details - see the expo's limitation. Let me know if you need any more details. Closing this issue, feel free to add more comments or reopen a new issue.

vineeth-vk11 commented 3 years ago

@Nautiyalsachin I am not using react-native-razorpay in expo managed work flow, I am using it in bare work flow after ejecting from expo.

Also, I created a new project with react native CLI and the issue is still there.

So expo is not the issue.

Nautiyalsachin commented 3 years ago

@vineeth-vk11 Is the error is same for both cases?

Nautiyalsachin commented 3 years ago

@vineeth-vk11 Please share the sample app here, so that I can download and try to debug it.

vineeth-vk11 commented 3 years ago

@Nautiyalsachin yes the error is same in both the cases.

I am attaching both the apps - React native CLI and expo ejected app

My Xcode version - 12.5 node version - 16.1.0 npm version - 7.11.2

RazorpayTest.zip RazorpayApp.zip

vineeth-vk11 commented 3 years ago

@Nautiyalsachin I installed Xcode 11.4 beside my Xcode 12.5.

Though xcode 11 is not supported on Big Mac Sur, I used the following solution to run it and to see if it can compile.

https://stackoverflow.com/questions/64983664/is-it-possible-to-run-xcode11-in-macos-big-sur

I was able to compile the code successfully on xcode 11.4 in both debug and release config.

So can we assume that the problem is there with xcode 12.5 ?

vineeth-vk11 commented 3 years ago

@Nautiyalsachin did you get a chance to look into the sample apps?

Nautiyalsachin commented 3 years ago

@vineeth-vk11 can you try uninstalling and installing the plugin again. Let me know if this solves the issue. Thanks.

vineeth-vk11 commented 3 years ago

@Nautiyalsachin I have tried doing it multiple times but it does not work.

I created sample apps too with both expo cli and react native cli but the issue is there in both.

I could compile the code on Xcode 11.4 but it is giving errors on xcode 12.5

Also updated to 2.2.5 today morning and got the same errors

Were you able to compile the above sample apps on xcode 12 ?

Nautiyalsachin commented 3 years ago

@vineeth-vk11 I recently updated the Razorpay-pod which will address the xcode 12.5 issue, latest pod is 1.1.13. You can confirm your pod version by checking podfile.lock in your ios folder.

vineeth-vk11 commented 3 years ago

@Nautiyalsachin yes pod version is 1.1.13 and it has the same error

Actually the number of errors increased from 5 to 7 after updating to 2.2.5 and 1.1.13

Screenshot 2021-05-14 at 11 13 10 PM

I am attaching the sample project code below, I have not modified anything in the code. I only ran below steps before compiling on xcode

  1. npx react-native init Razorpay
  2. npm install react-native-razorpay --legacy-peer-deps
  3. cd ios & pod install

Been looking for solutions and working on it for last 3days but unable to find the issue.

Razorpay.zip

Nautiyalsachin commented 3 years ago

Hi @vineeth-vk11, I tried the above sample app and it worked fine for me, here is the steps I did in the above sample app :

  1. npm install
  2. pod install from ios folder as pod were missing
  3. Assigned developer team.

Here is the attached sample app.

I would also recommend you check the default XCode version in your system. You can go in XCode > Preferences > Locations > Command Line Tools > Select XCode 12.5.

Razorpay.zip

vineeth-vk11 commented 3 years ago

Hi @Nautiyalsachin , I have downloaded the above attached sample code and the issue still there.

I have selected command line tools to xcode 12.5

I am using

Node - v 16.1.0 NPM - v 7.11.2 cocoapods - v 1.10.1 Swift version - 5.4

Can you tell me your node, npm, cocoapods and swift versions ?

punndcoder28 commented 3 years ago

@vineeth-vk11 @Nautiyalsachin I am also facing the same issue on our project. I have

react-native-razorpay 2.2.5 razorpay-pod 1.1.13 Node - v 16.0.0 NPM - v 7.10.0 cocoapods - v 1.10.1

I use Xcode 12.4 and M1 MacBook

vineeth-vk11 commented 3 years ago

@punndcoder28 I am starting to think that M1 macs might have this issue because I am also running on M1 mac.

Though I selected run on rosetta in my xcode info the issue is still there.

vineeth-vk11 commented 3 years ago

@Nautiyalsachin @punndcoder28 yes it is confirmed that issue is with arm64 on M1 mac

case 1 - Opened the terminal normally npx react-native run-ios Build Failed

case 2 - I enabled "Open with Rosetta" for terminal and opened the terminal again npx react-native run-ios Build successful

But the same does not work for Xcode. Even if I am opening the xcode after enabling "Open with Rosetta" it is compiling the code using arm64 and not x86.

Not sure how it can be changed to compile in x86 on xcode.

punndcoder28 commented 3 years ago

@vineeth-vk11 Your Xcode point makes sense, but for me even when I ran terminal with rosetta build failed.

vineeth-vk11 commented 3 years ago

@punndcoder28 can you paste the error you got when you ran with rosetta on the terminal ?

punndcoder28 commented 3 years ago

@vineeth-vk11 Your Xcode point makes sense, but for me even when I ran terminal with rosetta build failed.

@vineeth-vk11 @Nautiyalsachin I should be corrected. Works with rosetta 2 on terminal, but fails with Xcode like @vineeth-vk11 mentioned.

vineeth-vk11 commented 3 years ago

@punndcoder28 thanks for confirming

@Nautiyalsachin any workaround to compile using x86 instead of arm64 on Xcode until the issue is resolved ?

vineeth-vk11 commented 3 years ago

@Nautiyalsachin any updates on the issue ?

Nautiyalsachin commented 3 years ago

@vineeth-vk11 Can you share the error you are getting here?

vineeth-vk11 commented 3 years ago

@Nautiyalsachin this problem is there on M1 macs

Opening the terminal with Rosetta and running react-native run-ios works but without rosetta it gives the errors.

Even though xcode is opened with Rosetta it still uses arm64 to compile the code and not x86

Please test it on M1 macs

Image of the error is attached

118308855-16197680-b50a-11eb-9704-776973aa904c
Nautiyalsachin commented 3 years ago

Try changing Validate Workspace to YES in the Build Settings tab and let me know if the error still persists.

vineeth-vk11 commented 3 years ago

@Nautiyalsachin yes the error still persists after changing the Validate Workspace to YES in build settings.

Nautiyalsachin commented 3 years ago

@vineeth-vk11 Can we get on a call, I want to see your implementation and build settings.

niyatiArunk commented 3 years ago

Same issue, exists for me, I have a production app in Android that works fine, but while archive in IOS it was not working, need this to get resolved