Closed ericlathrop closed 1 month ago
I've fixed these warnings:
2024-07-17 12:55:28.665334-0400 HorseRacingNation[1066:25635] You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.
2024-07-17 12:55:28.665414-0400 HorseRacingNation[1066:25635] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
and I still get the same error on a physical device.
On the simulator, I'm now getting:
Error: xcrun simctl install 6AFEBED8-ED33-400B-93B1-5DFB3D47622E /Users/ericlathrop/Library/Developer/Xcode/DerivedData/HorseRacingNation-etzltayffrbasmapnqzwyfhbyaqm/Build/Products/Debug-iphonesimulator/HorseRacingNation.app exited with non-zero code: 22
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Simulator device failed to install the application.
The application's Info.plist does not contain a valid CFBundleVersion.
Ensure your bundle contains a valid CFBundleVersion.
Underlying error (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The application's Info.plist does not contain a valid CFBundleVersion.
It looks like you didn't follow this setup step: https://rnfirebase.io/messaging/usage/ios-setup
For your current error, it looks like a simple fix inside of Xcode is required: https://stackoverflow.com/questions/43111501/the-bundles-info-plist-does-not-contain-a-cfbundleversion-key-or-its-value-is-n
@Lyokone Sorry, it looks like you didn't read my comment https://github.com/invertase/react-native-firebase/issues/7913#issuecomment-2236938694 where I said I fixed those warnings and added those capabilities in your first link. They got removed when I deleted the auto-generated ios folders. I re-added them, and still get the same issue.
The CFBundleVersion is a simulator-only issue, and I've tried the change in your second link and it didn't change anything. On the real device I still get the original error.
This issue is not solved in any way, please re-open.
I did a binary search of my commits to find the change that caused this crash. It turns out adding a buildNumber
to the ios
section of my app.json
causes the crash. This also causes the issue with the simulator.
diff --git a/clients/horse-racing-nation-mobile/app.json b/clients/horse-racing-nation-mobile/app.json
index 4ceb5bd4e8..d39b6733f6 100644
--- a/clients/horse-racing-nation-mobile/app.json
+++ b/clients/horse-racing-nation-mobile/app.json
@@ -15,12 +15,13 @@
"**/*"
],
"ios": {
+ "buildNumber": 21,
+ "bundleIdentifier": "com.horseracingnationmobile",
"entitlements": {
"aps-environment": "production"
},
- "supportsTablet": true,
- "bundleIdentifier": "com.horseracingnationmobile",
- "googleServicesFile": "./config/GoogleService-Info.plist"
+ "googleServicesFile": "./config/GoogleService-Info.plist",
+ "supportsTablet": true
},
"android": {
"adaptiveIcon": {
@@ -28,7 +29,8 @@
"backgroundColor": "#222222"
},
"googleServicesFile": "./config/google-services.json",
- "package": "com.horseracingnationmobile"
+ "package": "com.horseracingnationmobile",
+ "versionCode": 20100
},
"notification": {
"icon": "./assets/images/icons/notification_small.png"
@ericlathrop can you elaborate on what is actually causing the problem? I always used buildNumber on app.json and never had any problem. I don't understand what's going on.
@davevilela Everything I know is documented in this issue. Sorry, but I'm not much of a native dev. I probably made a dozen builds to find the diff above that caused my app to crash. Reverting makes the app run.
Issue
My app was working last week. I updated some non-firebase libraries or something on Android, and when I returned to the iOS build, I get this crash.
The crash happens in FirebaseCore/Sources/FIRApp.m
It's an expo project.
Things I've tried:
I'm sorry, but I don't really know much about Macs, OSX, Objective-C, or Swift.
Project Files
Javascript
Click To Expand
#### `package.json`: ```json { "name": "horse-racing-nation-mobile", "version": "2.1.3", "main": "expo-router/entry", "scripts": { "start": "expo start", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web" }, "dependencies": { "@react-native-async-storage/async-storage": "^1.24.0", "@react-native-firebase/analytics": "^20.2.1", "@react-native-firebase/app": "^20.2.1", "@react-native-firebase/messaging": "^20.2.1", "@react-native-firebase/remote-config": "^20.2.1", "date-fns": "^3.6.0", "expo": "^51.0.21", "expo-build-properties": "~0.12.3", "expo-constants": "~16.0.2", "expo-dev-client": "~4.0.20", "expo-font": "~12.0.6", "expo-linear-gradient": "~13.0.2", "expo-linking": "~6.3.1", "expo-router": "~3.5.18", "expo-status-bar": "~1.12.1", "expo-store-review": "~7.0.2", "react": "18.2.0", "react-native": "0.74.3", "react-native-google-mobile-ads": "^14.1.0", "react-native-safe-area-context": "^4.10.8", "react-native-screens": "^3.31.1", "react-native-webview": "^13.10.5" }, "devDependencies": { "@babel/core": "^7.20.0" }, "private": true } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```
iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking") require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") require 'json' podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {} ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0' ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR'] platform :ios, podfile_properties['ios.deploymentTarget'] || '13.4' install! 'cocoapods', :deterministic_uuids => false prepare_react_native_project! target 'HorseRacingNation' do use_expo_modules! config = use_native_modules! use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS'] use_react_native!( :path => config[:reactNativePath], :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes', # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/..", :privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false', ) post_install do |installer| react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false, :ccache_enabled => podfile_properties['apple.ccacheEnabled'] == 'true', ) # This is necessary for Xcode 14, because it signs resource bundles by default # when building for devices. installer.target_installation_results.pod_target_installation_results .each do |pod_name, target_installation_result| target_installation_result.resource_bundle_targets.each do |resource_bundle_target| resource_bundle_target.build_configurations.each do |config| config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' end end end end post_integrate do |installer| begin expo_patch_react_imports!(installer) rescue => e Pod::UI.warn e end end end ``` #### `AppDelegate.mm`: ```objc #import "AppDelegate.h" #import
#import
#import
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// @generated begin @react-native-firebase/app-didFinishLaunchingWithOptions - expo prebuild (DO NOT MODIFY) sync-ecd111c37e49fdd1ed6354203cd6b1e2a38cccda
[FIRApp configure];
// @generated end @react-native-firebase/app-didFinishLaunchingWithOptions
self.moduleName = @"main";
// 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];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
return [self bundleURL];
}
- (NSURL *)bundleURL
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
// Linking API
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options {
return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
}
// Universal Links
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler {
BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result;
}
// Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
return [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
return [super application:application didFailToRegisterForRemoteNotificationsWithError:error];
}
// Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
return [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
@end
```
Android
Click To Expand
#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```
Environment
Click To Expand
**`react-native info` output:** ``` (node:87926) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead. (Use `node --trace-deprecation ...` to show where the warning was created) System: OS: macOS 14.5 CPU: (4) x64 Intel(R) Core(TM) i3-8100B CPU @ 3.60GHz Memory: 39.44 MB / 8.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 22.2.0 path: /usr/local/bin/node Yarn: Not Found npm: version: 10.8.1 path: /usr/local/bin/npm Watchman: version: 2024.05.06.00 path: /usr/local/bin/watchman Managers: CocoaPods: version: 1.15.2 path: /usr/local/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.5 - iOS 17.5 - macOS 14.5 - tvOS 17.5 - visionOS 1.2 - watchOS 10.5 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: version: 15.4/15F31d path: /usr/bin/xcodebuild Languages: Java: Not Found Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.74.3 wanted: 0.74.3 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `20.2.1` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `N` & `VERSION`
React Native Firebase
andInvertase
on Twitter for updates on the library.