configuration应用程序时发生Firebase错误 – 无法识别的select器已发送到课程

我在iOS应用中使用Firebase,并且拥有两个独立的Firebase项目,一个用于制作,一个用于开发。 我的两个.plist文件是GoogleService-Info.plistGoogleService-Info-Dev.plist ,我可以根据“目标” – >“生成设置” – >“其他Swift标志”中设置的标志进行select。

在AppDelegate里面didFinishLaunchingWithOptions

 #if DEBUG let buildFor = "DEV" #else let buildFor = "PROD" #endif let firebasePlistFileName = buildFor == "DEV" ? "GoogleService-Info-Dev" : "GoogleService-Info" let firebaseOptions = FIROptions(contentsOfFile: NSBundle.mainBundle().pathForResource(firebasePlistFileName, ofType: "plist")) FIRApp.configureWithOptions(firebaseOptions) // line causing new Firebase error 

直到今天,当我遇到另一个Cocoapod项目的问题时,这一直工作得很好。 我认为这发生在我清理Xcode项目或删除Derived Data文件夹时:

 dyld: Library not loaded: @rpath/OtherPod.framework/OtherPod Referenced from: /Users/me/Library/Developer/CoreSimulator/Devices/12345678-E1C4-480F-B1D9-C10823DEA810/data/Containers/Bundle/Application/AE7B6EB0-43AB-CCCC-BBBB-AAAA71BF/MyApp.app/MyApp Reason: image not found 

我最终通过在目标 – >常规 – >链接框架和库中select我的应用程序来解决这个问题,然后在Workspace文件夹(另外7个pod项目)中添加所有选项,并将其添加为可选项。 从那以后,我一直在面对这篇文章标题中描述的错误:

 2017-02-10 17:19:29.660 MyApp[12639:182433] +[NSData gtm_dataByGzippingData:error:]: unrecognized selector sent to class 0x10a0442e8 2017-02-10 17:19:29.680 MyApp[12639:182433] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSData gtm_dataByGzippingData:error:]: unrecognized selector sent to class 0x10a0442e8' *** First throw call stack: ( 0 CoreFoundation 0x0000000109d88d4b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00000001097f121e objc_exception_throw + 48 2 CoreFoundation 0x0000000109df8e44 +[NSObject(NSObject) doesNotRecognizeSelector:] + 132 3 CoreFoundation 0x0000000109d0e005 ___forwarding___ + 1013 4 CoreFoundation 0x0000000109d0db88 _CF_forwarding_prep_0 + 120 5 MyApp 0x0000000102d73c9d -[FIRNetwork postURL:payload:queue:usingBackgroundSession:completionHandler:] + 331 6 MyApp 0x0000000102d70e72 -[FIRClearcutLogger sendNextPendingRequestWithCompletionHandler:] + 570 7 MyApp 0x0000000102d70918 -[FIRClearcutLogger sendLogsWithCompletionHandler:] + 447 8 libdispatch.dylib 0x000000010a6ab978 _dispatch_call_block_and_release + 12 9 libdispatch.dylib 0x000000010a6d50cd _dispatch_client_callout + 8 10 libdispatch.dylib 0x000000010a6b2e17 _dispatch_queue_serial_drain + 236 11 libdispatch.dylib 0x000000010a6b3b4b _dispatch_queue_invoke + 1073 12 libdispatch.dylib 0x000000010a6b402b _dispatch_queue_override_invoke + 683 13 libdispatch.dylib 0x000000010a6b6385 _dispatch_root_queue_drain + 720 14 libdispatch.dylib 0x000000010a6b6059 _dispatch_worker_thread3 + 123 15 libsystem_pthread.dylib 0x000000010aa3a712 _pthread_wqthread + 1299 16 libsystem_pthread.dylib 0x000000010aa3a1ed start_wqthread + 13 ) libc++abi.dylib: terminating with uncaught exception of type NSException 

我已经尝试了很多不同的修复,包括添加到链接二进制库 , 添加到其他链接标志 ,并没有任何工作。

无法识别的select器可能是什么,我将如何更改/删除它? 这个问题是否可以归因于我所面对的较早的一个(图书馆未加载)?

为了澄清,当发生unrecognized selector sent to class错误的unrecognized selector sent to class发生时,Xcodedebugging导航器专注于线程7, FIRApp.configureWithOptions(firebaseOptions)行被突出显示。

更新

我发现通过恢复到以前的git提交(将我的存储库克隆到一个单独的目录中),然后使用当前的错误生成副本(包括根目录中的App-Name文件夹)replace旧提交中的大部分项目内容目录, 应用程序名称 .xcodeproj和应用程序名称 .xcworkspace。 我只在模拟器(运行iOS 10.2的iPhone 7)上testing,而且工作。 然后,我成功地提交了一个构build到iTunes Connect,并能够在我的设备上运行构build(iPhone 5c与10.2.1),但删除后,并尝试从Xcode运行构build,我又得到了同样的错误。 但是,在模拟器上运行时没有发生错误。 这与在物理设备和模拟器上发生的初始错误情况相反。

这让我记得最初发布的堆栈跟踪是在模拟器上运行应用程序。 在设备上运行产生的输出较less,特别是*** First throw call stack:之后的内容*** First throw call stack:只是(0x1d01cdf7 0x1c27f077 0x1d022467 0x1d020579 0x1cf453d8 0x31ff3f 0x31d653 0x31d05d 0x1c57d57 0x1c63e63 0x1c5b205 0x1c64391 0x1c65d9f 0x1c65ba7 0x1c877937 0x1c877490)而不是更具说明性的输出文件/函数名称。

我面临同样的问题。 请按照下列方式进行工作。

请确保您已在Other Linker Flags.添加了两个参数Other Linker Flags.

 $(inherited) -ObjC 

解决scheme: –

  - Remove all Framework from Project using Below command. 1. pod deintegrate 2. pod clean - Install pod file Again. 1. pod install 

问题: –您在项目中遇到了参考问题(在Specific Directery找不到框架)。

注意: –清理和生成项目。

确保GoogleToolboxForMac窗格中的GTMNSData + zlib.m仍在构build并链接到您的应用程序中。

在这里输入图像说明

确保-ObjC和-framework GoogleToolboxForMac在链接日志中:

在这里输入图像说明