ios - 在真实设备中调用方法 'FirebaseApp.configure()'时,应用程序崩溃

标签 ios swift firebase crash appdelegate

最近,我决定在真实设备上运行该应用程序,并收到一个崩溃的应用程序,并且寻找原因,发现它出现在FirebaseApp.configure()方法之后。

在模拟器中启动时,应用程序不会崩溃。

崩溃:

dyld`__abort_with_payload:
    0x101b0b2a4 <+0>:  mov    x16, #0x209
    0x101b0b2a8 <+4>:  svc    #0x80
->  0x101b0b2ac <+8>:  b.lo   0x101b0b2c8               ; <+36>
    0x101b0b2b0 <+12>: stp    x29, x30, [sp, #-0x10]!
    0x101b0b2b4 <+16>: mov    x29, sp
    0x101b0b2b8 <+20>: bl     0x101b097d8               ; cerror_nocancel
    0x101b0b2bc <+24>: mov    sp, x29
    0x101b0b2c0 <+28>: ldp    x29, x30, [sp], #0x10
    0x101b0b2c4 <+32>: ret    
    0x101b0b2c8 <+36>: ret    

通过此回溯:
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x0000000101b0b2ac dyld`__abort_with_payload + 8
    frame #1: 0x0000000101b12914 dyld`abort_with_payload_wrapper_internal + 104
    frame #2: 0x0000000101b12948 dyld`abort_with_payload + 16
    frame #3: 0x0000000101b0f77c dyld`dyld::halt(char const*) + 380
    frame #4: 0x0000000101ac0778 dyld`dyld::fastBindLazySymbol(ImageLoader**, unsigned long) + 176
    frame #5: 0x00000001b207963c libdyld.dylib`_dyld_fast_stub_entry(void*, long) + 80
    frame #6: 0x00000001b2077b80 libdyld.dylib`dyld_stub_binder + 60
    frame #7: 0x0000000100b88258 CheeseApp`__44+[UIViewController(APMScreenClassName) load]_block_invoke + 144
    frame #8: 0x000000010204327c libdispatch.dylib`_dispatch_client_callout + 20
    frame #9: 0x0000000102044c88 libdispatch.dylib`_dispatch_once_callout + 132
    frame #10: 0x0000000100b881c4 CheeseApp`+[UIViewController(APMScreenClassName) load] + 76
    frame #11: 0x00000001b1fa1500 libobjc.A.dylib`load_images + 1176
    frame #12: 0x0000000101abe19c dyld`dyld::notifySingle(dyld_image_states, ImageLoader const*, ImageLoader::InitializerTimingList*) + 480
    frame #13: 0x0000000101ace444 dyld`ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 556
    frame #14: 0x0000000101acd094 dyld`ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 192
    frame #15: 0x0000000101acd160 dyld`ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 96
    frame #16: 0x0000000101abe4f8 dyld`dyld::initializeMainExecutable() + 220
    frame #17: 0x0000000101ac3038 dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 4668
    frame #18: 0x0000000101abd22c dyld`dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*) + 432
    frame #19: 0x0000000101abd038 dyld`_dyld_start + 56

AppDelegate:
import UIKit
import Firebase

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        FirebaseApp.configure()
        return true
    }

    // MARK: UISceneSession Lifecycle

    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }

    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }
}

我试过的
  • 我更新了根目录
  • 中的GoogleService-Info.plist文件
  • 我更新了pod文件
  • 中的所有库
  • 我试图通过禁用方案
  • 中的Address Sanitizer解决问题
  • 我试图通过“将文件添加到...”来添加.plist文件。
  • 我试图运行这样的方法:
  •     override init() {
            FirebaseApp.configure()
        }
    
  • 我更新了“带库的二进制链接”中的库

  • 但是没有任何帮助。

    最佳答案

    这是Apple阻止免费开发人员帐户使用从iOS 13.3.1开始的动态框架的另一个症状。

    选项包括
    -升级到付费开发者帐户
    -降级至13.3。
    -对于CocoaPods,请使用use_modular_headers!而不是use_frameworks!
    另请参阅Library not loaded: @rpath/FBLPromises.framework/FBLPromises iOS 13.3.1

    关于ios - 在真实设备中调用方法 'FirebaseApp.configure()'时,应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60249693/

    相关文章:

    swift - 这个语法在 Swift 中是什么意思?

    swift - 如何在 Swift 4 中跟踪 Firebase iOS 的离线交易

    android - 从 Firebase 数据库中获取数据时如何显示加载消息?

    ios - 为什么 View 中的内容不显示在 Xcode 中

    ios - 如何禁用导航栏中的后退按钮

    swift - SwiftUI MVVM如何在功能后显示警报

    ios - SwiftUI 如何给 Slider 一个最小值和最大值并在 Text 中显示它的值?

    ios - 如何在uibutton之类的消息应用程序上使用角标(Badge)?

    ios - 如何在coredata中创建数据库 View

    android - Firebase 自定义身份验证错误 : The custom token format is incorrect