#Olly-terminal-reactnative

1 messages ยท Page 1 of 1 (latest)

edgy wind
#

Hey @dim wraith bear with me, I know nothing about Terminal mobile and we don't have any React Native support officially for this at Stripe

Can you give a bit more details about what you are trying to do exactly? What is in AppDelegate.m? Which library are you using?

dim wraith
#

this is how my AppDelegate.m looks like, what is weird is that in development, everything works good, but when I do the build to upload it to testFlight if fails

edgy wind
#

Can you share real code, not a picture? Discord supports code formatting and such like on Github and other tools, wrap it with three `

#

Also can you provide more details? What library are you building with exactly? You said 0.65.1 but what library is this?

dim wraith
#

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
#import <StripeTerminal/StripeTerminal.h>
#import "APPAPIClient.h"

static void InitializeFlipper(UIApplication *application) {
  FlipperClient *client = [FlipperClient sharedClient];
  SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
  [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
  [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
  [client addPlugin:[FlipperKitReactPlugin new]];
  [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
  [client start];
}
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef FB_SONARKIT_ENABLED
  InitializeFlipper(application);
#endif

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"Givergy"
                                            initialProperties:nil];

  if (@available(iOS 13.0, *)) {
      rootView.backgroundColor = [UIColor systemBackgroundColor];
  } else {
      rootView.backgroundColor = [UIColor whiteColor];
  }
#

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end ```
edgy wind
#

You need to wrap in three backticks on both sides

#

otherwise it's unreadable

dim wraith
#

I had to send it in 2 messages. I hope it is ok!

#
    "react-native": "0.65.1",```
#

and this is the version of react & react-native that I'm using

#

and also the minimum target sdk is iOS 11

edgy wind
#

what is that react-native version though? Like do you use a third-party library to use Terminal with React Native since we don't have support for it at Stripe?

dim wraith
#

In react native you create cross platform apps. I'm just doing a bridge to native iOS and nothing more, everything from stripe is used native, because I'm using BBPOS reader so everything must be done in iOS and ANDROID.

edgy wind
#

Gotcha thanks. And when you say everything works in Test mode, you mean locally with the simulator?

dim wraith
#

The weird part is that using my personal iPad and iPhone and Simulators everything works. And no error shown in AppDelegate.m

#

But when I do the build it throws the error of undeclared identifier SCPTerminal

edgy wind
#

ack, let me chat with some people on my team and see if I can find some pointers

dim wraith
#

Ok! Thank you very much for you implication!

edgy wind
#

Specifically this quote

In order for the Xcode project to build when you use Swift in the iOS static library you include in the module, your main app project must contain Swift code and a bridging header itself. If your app project does not contain any Swift code, a workaround can be a single empty .swift file and an empty bridging header.

dim wraith
#

I'm looking into stripe-react-native, native-modules-ios works perfect because I'm seeing readers while discovering it, it works readUsableCard also, I'm also into finishing the part for paying with card using BBPOS reader. I'll reach out to you with a result ๐Ÿ™‚

edgy wind
#

yeah I assume you configured something in XCode for your test build but for the TestFlight one something is not building/linking properly
Unfortunately we don't know much about this here ๐Ÿ˜ฆ

dim wraith
#

Unfortunately after adding stripe-react-native library seems that I encountered this errors and I don't have any idea how to fix them.

empty sandal
#

to be clear I don't think you need to add that project at all(it's for non-card-present Stripe integrations, not related to Terminal). The intention of the link above was specifically the context that using a native Swift SDK(like either stripe-ios there, or in your case, stripe-terminal-ios) sometimes seems to need an empty bridging header and maybe adding such a thing might be part of a solution for you.

edgy wind
#

@dim wraith sorry I think we misunderstood each other. I never said to add the stripe-react-native library. This one is completely unrelated and doesn't work with Terminal. I linked you to a specific part of the readme that covered some common build errors that would hopefully help you fix yours

#

ah damn @empty sandal was faster already sorry

dim wraith
#

Everything is according to their files, in terms of bridging and how components are created and used. The only problem is the SCPTerminal on building. Do you have knowledge on working with readers on iOS?

edgy wind
#

@olive frost is taking over. Unfortunately we know nothing about Terminal + ReactNative, it's not a stack we support at all at Stripe for Terminal.

olive frost
#

๐Ÿ‘‹

#

Right, that's pretty much the state of things @dim wraith -- we don't have support for Terminal using React Native currently. YOu're welcome to set up your own RN bridges from your app to the iOS SDK to accomplish this, but we won't be able to support issues with that part of your integration

dim wraith
#

Hey! The thing is that SCPTerminal.setTokenProvider si set native and has no connection with react native. While working with simulators and real devices everything works as expected, but when uploading app to TestFlight I'm running into that error. For me is pretty much weir that I don't have any errors from xCode in the development process but somehow on build the import is not recognized, because tha't why I think it manages to throw "use of undeclared identifier SCPTerminal"

olive frost
#

I see, well unfortunately this goes beyond my understanding of ios development, but I can work with the Terminal & iOS teams here to figure out if there's something we can do to help you.

#

Is it possible to distill this down to a minimal repo you could share on github with steps to follow to encounter the same error as you?

#

I'm worried that without that it will be difficult for us to provide much more guidance here

#

But if you can do that and contact us via support ( https://support.stripe.com/contact ), mentioned our usernames here, we should be able to follow those steps to confirm if we encounter the same thing and raise the issue with our colleagues

olive frost
#

I need to step away so Iโ€™m going to archive this thread. If you need help with anything else please ask in #dev-help or contact Stripe Support: https://support.stripe.com/contact