0

I have a React Native app with a custom native plugin.

The app works fine when I test it with Xcode on my device.

I uploaded the exact same app to the App Store and it got broken.

On my iPhone it doesn't actually start and on my iPad it is buggy:

  • I have to tap buttons twice
  • Code order is wrong (may threading / rendering)
  • Events from the plugin sometimes get fired and sometimes not. Totally random. (could also be rendering issue)

Unfortunately, I can't debug the TestFlight App.

Does someone have a starting point why this could happen?

chocolate cake
  • 2,129
  • 5
  • 26
  • 48
  • 1
    I bet it is not related to TestFlight itself. When you run from Xcode your app runs in Debug Configuration (by default). On TestFlight, it runs in Release. To test the Release Mode, you can click on the Scheme, Run, and select Release. – CZ54 May 18 '22 at 16:24
  • Thank you for the hint, @CZ54! I can simulate the errors locally now. That's a huge aid. I haven't figured out yet why it happens because there are also no error messages and disabling all optimizations didn't help also. I will try further. – chocolate cake May 20 '22 at 09:46

1 Answers1

0

I found the problem. It was in my Plugin and how I expose it. My index.ts file looked like this:

import { NativeModules } from 'react-native';
const { MyPlugin } = NativeModules;
export default MyPlugin;

Better with no default export:

import { NativeModules } from 'react-native';
export const { MyPlugin } = NativeModules;

I don't know why a default export doesn't work in release mode. I tried all release flags to be the same as default, but it was the same result. So, just changing the way of export was fixing it.

chocolate cake
  • 2,129
  • 5
  • 26
  • 48