将React Native升级到0.71.2和iOS 15.2后模拟器出现黑屏

ffscu2ro  于 2023-03-19  发布在  React
关注(0)|答案(1)|浏览(492)

我最近升级到了0.71.2,当我的应用程序在模拟器中打开时,它会显示Splash屏幕,然后淡出到黑屏。

我在Xcode的日志中看到以下内容:

2023-03-05 14:26:02.425529-0700 swoop[46482:1781261] <Warning>: The value for FacebookAdvertiserIDCollectionEnabled is currently set to FALSE so you're sending app events without collecting Advertiser ID. This can affect the quality of your advertising and analytics results.
2023-03-05 14:26:02.568162-0700 swoop[46482:1781382] [boringssl] boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics
2023-03-05 14:26:02.572400-0700 swoop[46482:1781382] [boringssl] boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics
2023-03-05 14:26:02.583568-0700 swoop[46482:1781375] [boringssl] boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics
2023-03-05 14:26:02.766479-0700 swoop[46482:1781403] [boringssl] boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics
2023-03-05 14:26:02.776339-0700 swoop[46482:1781383] [boringssl] boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics
2023-03-05 14:26:03.345793-0700 swoop[46482:1781386] 7.0.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more:
2023-03-05 14:26:03.400447-0700 swoop[46482:1781386] 7.0.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2023-03-05 14:26:32.653488-0700 swoop[46482:1782007] [boringssl] boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics

这是我的AppDelegate.mm

/**
 * 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 "RNSplashScreen.h"
#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKCoreKit/FBSDKCoreKit-swift.h>
#import "RNGoogleSignin.h"
#import <GoogleMaps/GoogleMaps.h>
#import "RNNotifications.h"
#import <Firebase.h>
#import <UserNotifications/UserNotifications.h>
#import <React/RCTLinkingManager.h>
#import <CodePush/CodePush.h>

#import <React/RCTAppSetupUtils.h>


@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  
  self.moduleName = @"swoop";
  self.initialProps = @{};

  if ([FIRApp defaultApp] == nil) {
     [FIRApp configure];
   }
  
  [[FBSDKApplicationDelegate sharedInstance] application:application
                         didFinishLaunchingWithOptions:launchOptions];
  
  return YES;
}

- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) {
    return YES;
  }

  if ([RCTLinkingManager application:app openURL:url options:options]) {
    return YES;
  }

  return NO;
}

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

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
  [RNNotifications didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
  [RNNotifications didFailToRegisterForRemoteNotificationsWithError:error];
}

- (BOOL)concurrentRootEnabled
{
  return true;
}

@end

这是我的Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, min_ios_version_supported
prepare_react_native_project!

flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'swoop' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],

    :flipper_configuration => flipper_config,
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  # React Native Maps dependencies
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

  permissions_path = '../node_modules/react-native-permissions/ios'

  pod 'react-native-fbsdk-next', :path => '../node_modules/react-native-fbsdk-next'
  pod 'react-native-maps', :path => '../node_modules/react-native-maps'
  pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'
  pod 'Permission-LocationAccuracy', :path => "../node_modules/react-native-permissions/ios/LocationAccuracy"
  pod 'Permission-LocationWhenInUse', :path => "../node_modules/react-native-permissions/ios/LocationWhenInUse"
  pod 'Permission-Notifications', :path => "../node_modules/react-native-permissions/ios/Notifications"
  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
#  use_flipper!()
  
  post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
      end
    end
  end
end
ac1kyiln

ac1kyiln1#

您是否配置了Firebase应用程序?您可能需要查看https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
还有:
1.警告“FacebookAdvertiserIDCollectionEnabled的值当前设置为FALSE,因此您正在发送应用事件而不收集广告客户ID”不是错误,而只是一条警告消息。它表明您没有收集广告客户ID,这可能会影响广告和分析结果的质量。
1.错误消息“[boringssl] boringssl_metrics_log_metric_block_invoke(151)Failed to log metrics”是Firebase使用的BoringSSL库的一个潜在问题。此错误消息可能表示库中的指标记录功能存在问题。
1.警告消息“尚未配置默认Firebase应用程序。添加'[FIRApp configure];“(Swift中的FirebaseApp.configure())添加到您的应用初始化”表明您的React Native项目中的默认Firebase应用尚未正确配置。要解决此问题,您需要将FirebaseApp.configure()函数添加到您的应用初始化代码。
1.消息“[Firebase/消息传递][I-FCM 001000] FIRMessaging远程通知代理已启用,将混合远程通知接收器处理程序。如果您希望手动集成Firebase消息传递,请将“FirebaseAppDelegateProxyEnabled”添加到您的Info.plist,并将其设置为NO”是Firebase的建议,如果您希望手动集成Firebase消息传递,您应该将“FirebaseAppDelegateProxyEnabled”添加到Info.plist文件中,并将其设置为NO。
错误消息“[boringssl] boringssl_metrics_log_metric_block_invoke(151)Failed to log metrics”再次与Firebase所使用的BoringSSL库有关,表明库中的指标日志记录功能可能存在问题。

相关问题