I am trying to port an iOS app over to React Native.
In this iOS app, one of the functions that needs to be done is to integrate it with a PayPal library (which is currently deprecated - we want to move away from it at some point later this year, but do not have the resources to do so now).
All we're doing with this library is obtaining a unique code from PayPal - that requires a View Controller to pop up, accept client credentials and return a code giving access.
I am extremely new to Objective-C.
I've got this so far (note: I have not included all the methods/properties but can include any missing):
@implementation PaypalSdk- (IBAction)obtainConsent { // Choose whichever scope-values apply in your case. See `PayPalOAuthScopes.h` for a complete list of available scope-values. NSSet *scopeValues = [NSSet setWithArray:@[kPayPalOAuth2ScopeOpenId, kPayPalOAuth2ScopeEmail, kPayPalOAuth2ScopeAddress, kPayPalOAuth2ScopePhone]]; PayPalProfileSharingViewController *psViewController; psViewController = [[PayPalProfileSharingViewController alloc] initWithScopeValues:scopeValues configuration:self.payPalConfig delegate:self]; // Present the PayPalProfileSharingViewController [self presentViewController:psViewController animated:YES completion:nil];}RCT_EXPORT_MODULE()RCT_EXPORT_METHOD(generateCode: (RCTResponseSenderBlock)callback) { [PayPalMobile initializeWithClientIdsForEnvironments:@{PayPalEnvironmentProduction : @"PRODUCTIONKEYHERE", PayPalEnvironmentSandbox : @"SANDBOXKEYHERE"}]; [self obtainConsent]; // TODO: eventually pass correctly generated code here callback(@[[NSNull null], @"code"]);}@end
I am basing this off of this library:
And this documentation:
https://github.com/paypal/PayPal-iOS-SDK/blob/master/docs/profile_sharing_mobile.md
However when trying what I am above, I get the following error:
How exactly should I resolve this? It seems to need a View Controller but I'm not totally sure how to launch one from React Native in this context.
All we're trying to get is the shared profile information.
And just for reference, this is my .h file:
#import "RCTBridgeModule.h"@interface PaypalSdk : UIViewController <RCTBridgeModule, PayPalProfileSharingDelegate>@property(nonatomic, strong, readwrite) NSString *environment;@property(nonatomic, strong, readwrite) NSString *resultText;@end