razorpay / react-native-razorpay

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

No visible @interface for 'Razorpay' (aka 'RNRazorpayCheckout') declares the selector 'setExternalWalletSelectionDelegate:' #320

Closed rsunbabu closed 3 years ago

rsunbabu commented 3 years ago

Description

Build using XCODE isnt working. The same is working without any flaw when run on a simulator.

Razorpay Package Version :

Open Package.json. > react-native-razorpay "^2.2.4"

Xcode Version (iOS) :

Open Xcode > Go to About Xcode > Xcode 12.4(12D4e).

Razorpay-pod version (iOS) :

Go to your project path > Go to folder named ios > open 'podfile.lock' file > search for 'razorpay-pod' > razorpay-pod (1.1.12)

Java and Gradle Version (android) :

Android is working fine, build and APK generated and tested

What you did:

  1. Integrated RP with RN for both the paltforms (Android & iOS)
  2. Have used vscode to build the functionality

What happened:

Android worked and for iOS, stared the build and the errors were visible

Refer the screenshot attached 4

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. compile the RN app on VScode and run using the simulator, works fine
  2. used the following command to make the "main.jsbundle" react-native bundle --platform ios --assets-dest ./ --dev false --entry-file index.js --bundle-output ios/main.jsbundle
  3. when opened in XCODE and set it to "Release"
  4. As version set was 11, here too in XCODE the version was set to 11
  5. Product > clean
  6. Product > Build
  7. Build failed

Suggested solution:

Had tried all the options given in the docs, none worked

Code example, screenshot, or link to a repository:

Please provide a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

Nautiyalsachin commented 3 years ago

@rsunbabu You have replaced RNRazorpayCheckout with RazorpayCheckout on line number 21. If the issue still persists then I will suggest you to remove the Razorpay plugin and add it again.

rsunbabu commented 3 years ago

Thankyou, its working. Please close this.

As per your suggestion, I had re-run the "npm i react-native-razorpay" but without uninstalling it

ghost commented 3 years ago

Facing the same issue @Nautiyalsachin .

My configuration details goes here:-

MacOS 11.2.2 XCode 12.4

"react-native": "0.60.4" "react-native-razorpay": "2.1.3"

Tried removing node_modules and Pods folder, installed back again. Tried upgrading "react-native-razorpay" to "2.2.4" as well. No luck so far.

Any help would be greatly appreciated!!!

Nautiyalsachin commented 3 years ago

@bala-kredx It would help if you can add more details here. Screenshots, code snippets will help.

ghost commented 3 years ago

@Nautiyalsachin

Screenshot 2021-03-11 at 3 13 15 PM

Couldnt generate the iOS build in Xcode.

Using the below in package.json

"react-native-razorpay": "2.1.3", "react-native": "0.60.4",

No pods present in podfile for razorpay.

RazorpayCheckout.m

`
//  RazorpayCheckout.m
//  RazorpayCheckout
//
//  Created by Akshay Bhalotia on 29/08/16.
//  Copyright © 2016 Razorpay. All rights reserved.
//

#import "RazorpayCheckout.h"
#import "RazorpayEventEmitter.h"

//#import <Razorpay/Razorpay.h>
#import <Razorpay/Razorpay-Swift.h>

@interface RazorpayCheckout () <RazorpayPaymentCompletionProtocolWithData,
ExternalWalletSelectionProtocol>

@end

@implementation RazorpayCheckout

RCT_EXPORT_MODULE()

RCT_EXPORT_METHOD(open : (NSDictionary *)options) {

    NSString *keyID = (NSString *)[options objectForKey:@"key"];
    dispatch_sync(dispatch_get_main_queue(), ^{
        Razorpay *razorpay = [Razorpay initWithKey:keyID
                               andDelegateWithData:self];
        [razorpay setExternalWalletSelectionDelegate:self];

        [razorpay open:options];
    });
}

- (void)onPaymentSuccess:(nonnull NSString *)payment_id
                 andData:(nullable NSDictionary *)response {
    [RazorpayEventEmitter onPaymentSuccess:payment_id andData:response];
}

- (void)onPaymentError:(int)code
           description:(nonnull NSString *)str
               andData:(nullable NSDictionary *)response {
    [RazorpayEventEmitter onPaymentError:code description:str andData:response];
}

- (void)onExternalWalletSelected:(nonnull NSString *)walletName
                 WithPaymentData:(nullable NSDictionary *)paymentData {
    [RazorpayEventEmitter onExternalWalletSelected:walletName
                                           andData:paymentData];
}
`
Nautiyalsachin commented 3 years ago

Hi @baalarazor, As I can see now you are using 2.1.4 plugin version, please upgrade that to the latest 2.2.4. Also, run a command pod update from your ios folder, that will download the latest iOS SDK, which will fix this issue. Let me know if this still persists. Thanks.

ghost commented 3 years ago

@Nautiyalsachin

Screenshot 2021-03-11 at 4 37 58 PM

The aforementioned errors arise when I do the following:-

  1. Updated react-native-razorpay npm package to 2.2.4
  2. Removed node_modules and installed again, run pod update from my ios folder.
  3. Tried generating a build in xcode.

Thanks.

Nautiyalsachin commented 3 years ago

@bala-kredx Can you share the razorpay-pod version from your project? You can find it inside ios>podfile.lock file.

ghost commented 3 years ago

@bala-kredx Can you share the razorpay-pod version from your project? You can find it inside ios>podfile.lock file.

@Nautiyalsachin

- razorpay-pod (1.1.12)

Nautiyalsachin commented 3 years ago

Please create a sample app and share with us here, we will check it.

ghost commented 3 years ago

@Nautiyalsachin

Here's the git repo for simple app with react native 0.60.4 and latest react-native-razorpay Getting the errors as mentioned above in the thread https://github.com/bala-kredx/Sample

Thanks.

ghost commented 3 years ago

@Nautiyalsachin Any update on this front?

Nautiyalsachin commented 3 years ago

@bala-kredx - It worked for me. I did

  1. npm install
  2. pod repo update inside ios folder.
  3. pod install.

I am not seeing any error. Let me know if I have missed anything here.

ghost commented 3 years ago

Did the same here. Running into the issues as I shared above. @Nautiyalsachin

Nautiyalsachin commented 3 years ago

Hey @bala-kredx, please try removing the plugin and adding it again, as there can be some connectivity issue in between react native and XCode.

You can also try this suggestion from React Native Documentation.

If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues.

ghost commented 3 years ago

@Nautiyalsachin Tried the above. Couldn't succeed build generation. Here are my tries in steps:-

Try 1:-

- npm uninstall react-native-razorpay
- rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-map-* && rm -rf node_modules/ && npm cache verify 
- restart my Mac (Mac 11.2.3 - Apple M1 Chip)
- npm i
- npm i react-native-razorpay
- npm start -- --reset-cache
- Goto Xcode, Clean Build folder, Build again.

(Running into same set of issues as mentioned below :- )

Screenshot 2021-03-16 at 12 44 20 PM

Try 2:-

- npm uninstall -g react-native-cli
- Restart my Mac
- rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-map-* && rm -rf node_modules/ && npm cache verify 
- npm i
- npm i react-native-razorpay
- npm start -- --reset-cache
- Goto Xcode, Clean Build folder, Build again.

(Running into the same 5 issues as mentioned above)

Nautiyalsachin commented 3 years ago

@bala-kredx Can you try manual linking also? You can refer our readme manual section for more details.

ghost commented 3 years ago

@bala-kredx Can you try manual linking also? You can refer our readme manual section for more details.

Okay, would try it now!

ghost commented 3 years ago

@Nautiyalsachin tried out manual linking. Still gives the same errors on iOS build generation.

Nautiyalsachin commented 3 years ago

@bala-kredx I have tried the sample app, you shared and the linking is working fine for me, I would suggest you downgrade the XCode and try again.

ghost commented 3 years ago

@Nautiyalsachin Could not downgrade Xcode, as the lower versions such as 11.x isn't getting installed in my machine.

mosamlife commented 3 years ago

@bala-kredx do you use the Apple Silicon MacBook? if Yes then try running with Rosetta 2.