Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
rsunbabu opened this issue Mar 3, 2021 · 22 comments

Comments

@rsunbabu
Copy link

rsunbabu commented Mar 3, 2021

Description

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

  • Specific to iOS Users :-
  • I have tried updating Razorpay pod to the latest version by using 'pod update'. Yes

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
Copy link
Contributor

@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
Copy link
Author

rsunbabu commented Mar 5, 2021

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
Copy link

ghost commented Mar 10, 2021

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
Copy link
Contributor

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

@ghost
Copy link

ghost commented Mar 11, 2021

@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
Copy link
Contributor

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
Copy link

ghost commented Mar 11, 2021

@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
Copy link
Contributor

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

@ghost
Copy link

ghost commented Mar 11, 2021

@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
Copy link
Contributor

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

@ghost
Copy link

ghost commented Mar 11, 2021

@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
Copy link

ghost commented Mar 15, 2021

@Nautiyalsachin
Any update on this front?

@Nautiyalsachin
Copy link
Contributor

@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
Copy link

ghost commented Mar 15, 2021

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

@Nautiyalsachin
Copy link
Contributor

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
Copy link

ghost commented Mar 16, 2021

@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
Copy link
Contributor

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

@ghost
Copy link

ghost commented Mar 17, 2021

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

Okay, would try it now!

@ghost
Copy link

ghost commented Mar 17, 2021

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

@Nautiyalsachin
Copy link
Contributor

@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
Copy link

ghost commented Mar 23, 2021

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

@mosamlife
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants