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

IOS: App crashed on start React Native 0.76.2 / expo 52 #30

Open
JBlazej opened this issue Nov 18, 2024 · 3 comments
Open

IOS: App crashed on start React Native 0.76.2 / expo 52 #30

JBlazej opened this issue Nov 18, 2024 · 3 comments

Comments

@JBlazej
Copy link

JBlazej commented Nov 18, 2024

Hi team,
After upgrading to a new version of React Native (expo), the app won't start.

Got fatal error here

public func devLauncherController(_ developmentClientController: EXDevLauncherController, didStartWithSuccess success: Bool) {
    guard let rctAppDelegate = (UIApplication.shared.delegate as? RCTAppDelegate) else {
      fatalError("The `UIApplication.shared.delegate` is not a `RCTAppDelegate` instance.")
    }
...
}

I found a problem with [WonderPush setupDelegateForApplication:application]; when I commented that this app works normally.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   self.moduleName = @"main";
  [WonderPush setClientId:@"---" secret:@"----"];
  // [WonderPush setupDelegateForApplication:application]; // –> Comment this and the app start
  [WonderPush setupDelegateForUserNotificationCenter];
  
  // You can add your custom initial props in the dictionary below.
  // They will be passed down to the ViewController used by React Native.
  self.initialProps = @{};

  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

I also tried this from your documentation use like that and the app never starts only black screen is shown.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   self.moduleName = @"main";
  [WonderPush setClientId:@"---" secret:@"----"];
  [WonderPush setupDelegateForApplication:application];
  [WonderPush setupDelegateForUserNotificationCenter];
  
  // You can add your custom initial props in the dictionary below.
  // They will be passed down to the ViewController used by React Native.
  self.initialProps = @{};

  return YES;
}

I use the latest version of the SDK

"react-native-wonderpush": "2.3.0",
"react-native-wonderpush-fcm": "1.0.9",

ios

deploymentTarget: '15.1',
useFrameworks: 'static',

and still use newArchEnabled: false but gonna need to upgrade very soon.

@ofavre
Copy link
Member

ofavre commented Dec 9, 2024

Hi,

WonderPush.setupDelegateForApplication: replaces the AppDelegate with our own instance that forwards every call to the previously registered AppDelegate, however, as you outline in your issue this does change the actual type of the AppDelegate instance.

Our documentation for this call outlines a solution: remove the call to WonderPush.setupDelegateForApplication: and replace it with manually forwarding the necessary methods described in the documentation. You have a sample code at the end of the section.
https://docs.wonderpush.com/docs/ios-sdk#setupdelegateforapplication

@dhruvpvx
Copy link

hey @JBlazej, as I can see you are using wonderpush in an eas managed project, can you guide me how did you managed to add WonderPushNotificationServiceExtension with plugin, if possible can you share your config plugin file?

@JBlazej
Copy link
Author

JBlazej commented Jan 6, 2025

Hi @dhruvpvx. We used this plugin expo-apple-target

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