Skip to content

🔥 iOS App running on iOS 14 crashes every-time new push comes #3944

@umang-simform

Description

@umang-simform

The app is crashing every time it gets new push notification in iOS 14 public beta.
Even if the app is in the background then also it is crashing on new push notifications.

Here are details/SS on where it is crashing:
Path: Pods/Development Pods/RNFBMessaging/RNFBMessaging+AppDelegate.m
Line number: 125
Screenshot 2020-07-15 at 11 10 01 AM

Here is the log from Xcode console:

2020-07-15 10:55:36.457389+0530 Yac[840:85040] [javascript] Running "Yac" with {"rootTag":1,"initialProps":{"isHeadless":false}}
2020-07-15 10:55:36.476670+0530 Yac[840:84824] [native] [GESTURE HANDLER] Initialize gesture handler for root view <RCTRootContentView: 0x106528880; reactTag: 1; frame = (0 0; 375 812); gestureRecognizers = <NSArray: 0x283963bd0>; layer = <CALayer: 0x2831412e0>>
2020-07-15 10:55:43.928435+0530 Yac[840:85046] BackgroundSession <5A01E8D4-2071-4ED8-A69D-6BF8A6438FA2> connection to background transfer daemon invalidated
2020-07-15 10:56:32.667415+0530 Yac[840:85051] dnssd_clientstub write_all(33) DEFUNCT
2020-07-15 10:56:32.667437+0530 Yac[840:85051] dnssd_clientstub deliver_request ERROR: write_all(33, 50 bytes) failed
2020-07-15 10:56:32.667455+0530 Yac[840:85051] dnssd_clientstub write_all(33) DEFUNCT
2020-07-15 10:56:32.667942+0530 Yac[840:85160] [connection] nw_read_request_report [C18] Receive failed with error "Software caused connection abort"
2020-07-15 10:56:32.668385+0530 Yac[840:85160] [connection] nw_read_request_report [C15] Receive failed with error "Software caused connection abort"
2020-07-15 10:56:32.669124+0530 Yac[840:85160] [connection] nw_read_request_report [C10] Receive failed with error "Software caused connection abort"
2020-07-15 10:56:32.669244+0530 Yac[840:85160] [connection] nw_read_request_report [C11] Receive failed with error "Software caused connection abort"
2020-07-15 10:56:34.019286+0530 Yac[840:85906] BackgroundSession <6EBD8A5E-6E77-41DD-B61C-D1729FD5D711> connection to background transfer daemon invalidated
2020-07-15 10:57:04.369237+0530 Yac[840:86461] SocketStream read error [0x280028fd0]: 1 57
2020-07-15 10:57:04.369306+0530 Yac[840:86457] SocketStream read error [0x280028c60]: 1 57
2020-07-15 10:57:04.369693+0530 Yac[840:86457] SocketStream read error [0x280028a50]: 1 57
2020-07-15 10:57:04.370628+0530 Yac[840:86457] [native] Error occurred, shutting down websocket connection: Websocket exception Error Domain=NSPOSIXErrorDomain Code=57 "Socket is not connected" UserInfo={_kCFStreamErrorCodeKey=57, _kCFStreamErrorDomainKey=1}
2020-07-15 10:57:04.371719+0530 Yac[840:85905] [connection] nw_socket_handle_socket_event [C20.1:1] Socket SO_ERROR [9: Bad file descriptor]
2020-07-15 10:57:04.372047+0530 Yac[840:85905] [connection] nw_socket_get_input_frames [C20.1:1] recvmsg(fd 8, 1024 bytes) [57: Socket is not connected]
2020-07-15 10:57:04.372547+0530 Yac[840:85905] [connection] nw_socket_handle_socket_event [C17.1:1] Socket SO_ERROR [9: Bad file descriptor]
2020-07-15 10:57:04.372654+0530 Yac[840:85905] [connection] nw_socket_get_input_frames [C17.1:1] recvmsg(fd 34, 1024 bytes) [57: Socket is not connected]
2020-07-15 10:57:04.372735+0530 Yac[840:85905] [connection] nw_socket_handle_socket_event [C3:1] Socket SO_ERROR [9: Bad file descriptor]
2020-07-15 10:57:04.374597+0530 Yac[840:85040] [javascript] Cannot connect to the Metro server.

Try the following to fix the issue:
- Ensure that the Metro server is running and available on the same network
- Ensure that the Metro server URL is correctly set in AppDelegate

URL: 192.168.0.108:8081

Error: The operation couldn’t be completed. Socket is not connected
2020-07-15 10:57:04.376680+0530 Yac[840:85905] [connection] nw_socket_get_input_frames [C3:1] recvmsg(fd 36, 1024 bytes) [57: Socket is not connected]
2020-07-15 10:57:04.376803+0530 Yac[840:85905] [connection] nw_socket_handle_socket_event [C4:1] Socket SO_ERROR [9: Bad file descriptor]
2020-07-15 10:57:04.376882+0530 Yac[840:85905] [connection] nw_socket_get_input_frames [C4:1] recvmsg(fd 40, 1024 bytes) [57: Socket is not connected]
2020-07-15 10:57:04.376948+0530 Yac[840:85905] [connection] nw_socket_handle_socket_event [C8:1] Socket SO_ERROR [9: Bad file descriptor]
2020-07-15 10:57:04.378674+0530 Yac[840:85905] [connection] nw_socket_get_input_frames [C8:1] recvmsg(fd 54, 1024 bytes) [57: Socket is not connected]
2020-07-15 10:57:04.378990+0530 Yac[840:85905] [connection] nw_read_request_report [C24] Receive failed with error "Software caused connection abort"
2020-07-15 10:57:04.379107+0530 Yac[840:85905] [connection] nw_read_request_report [C21] Receive failed with error "Software caused connection abort"
2020-07-15 10:57:04.380156+0530 Yac[840:85905] [connection] nw_read_request_report [C23] Receive failed with error "Software caused connection abort"
2020-07-15 10:57:04.380321+0530 Yac[840:85905] [connection] nw_read_request_report [C25] Receive failed with error "Software caused connection abort"
2020-07-15 10:57:04.725876+0530 Yac[840:85051] dnssd_clientstub write_all(33) DEFUNCT
2020-07-15 10:57:04.725934+0530 Yac[840:85051] dnssd_clientstub deliver_request ERROR: write_all(33, 50 bytes) failed
2020-07-15 10:57:04.725959+0530 Yac[840:85051] dnssd_clientstub write_all(33) DEFUNCT

Project Files

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'Yac' do
    # Pods for Yac

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"

  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

AppDelegate.m:

 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#import "AppDelegate.h"

#import "RNSplashScreen.h"
#import <Firebase.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <AppCenterReactNativeShared/AppCenterReactNativeShared.h>
#import <AppCenterReactNative.h>
#import <AppCenterReactNativeAnalytics.h>
#import <AppCenterReactNativeCrashes.h>
#import "Orientation.h"
#import "Intercom/intercom.h"
#import <CodePush/CodePush.h>
#import <React/RCTLinkingManager.h>


#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitLayoutPlugin/SKDescriptorMapper.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.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 {
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"Yac"
                                            initialProperties:nil];

  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  
  //App Center 
  [AppCenterReactNative register];
  [AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];
  [AppCenterReactNativeCrashes registerWithAutomaticProcessing];
  
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  // Firebase Push Notification
  if ([FIRApp defaultApp] == nil) {
    [FIRApp configure];
  }

  // Intercom
  [Intercom setApiKey:@"ios_sdk-53f060bd16a0707a7813af634c6fe0a0d8e7a9e0" forAppId:@"pehhwn3g"];

  //Flipper
  #ifdef FB_SONARKIT_ENABLED
    InitializeFlipper(application);
  #endif
  
  //Splash screen
  [RNSplashScreen show];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [CodePush bundleURL];
#endif
}

// Screen orientation
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    return [Orientation getOrientation];
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler {
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  return [RCTLinkingManager application:application openURL:url
                      sourceApplication:sourceApplication annotation:annotation];
}

// Only if your app is using [Universal Links] (https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html).
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
 return [RCTLinkingManager application:application
                  continueUserActivity:userActivity
                    restorationHandler:restorationHandler];
}

@end


Android

Click To Expand

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

info Fetching system and libraries information...
System:
    OS: macOS 10.15.5
    CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
    Memory: 5.72 GB / 32.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.3.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2, 29.0.3
      System Images: android-25 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6514223
    Xcode: 11.5/11E608c - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_252 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.0 => 0.63.0 
  npmGlobalPackages:
    *react-native*: Not Found

Packages information:

    "@react-native-firebase/analytics": "^7.3.1",
    "@react-native-firebase/app": "^8.2.0",
    "@react-native-firebase/database": "^7.3.2",
    "@react-native-firebase/messaging": "^7.4.2"
  • Platform that you're experiencing the issue on:
    • [*] iOS
    • Android
    • [*] iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • Firebase module(s) you're using that has the issue:
    • Messaging
  • Are you using TypeScript?
    • N


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions