我有一个iOS项目,其中包括Firebase和Google Toolbox For Mac via Pods:
target 'MyApp' do
pod 'GoogleToolboxForMac', '~> 2.1'
pod 'GTMSessionFetcher', '~> 1.1'
pod 'gtm-logger', '~> 0.0.5'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
end
在AppDelegate中配置:
@implementation AppDelegate
-(instancetype)init {
self = [super init];
[FIRApp configure];
return self;
}
当我运行项目时,我收到此错误:
<FIRMessaging/INFO> FIRMessaging library version 1.2.2
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSData gtm_dataByGzippingData:error:]: unrecognized selector sent to class 0x10a548e88'
*** First throw call stack:
(
0 CoreFoundation 0x000000010a326f65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000109da0deb objc_exception_throw + 48
2 CoreFoundation 0x000000010a32f48d +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010a27cf7a ___forwarding___ + 970
4 CoreFoundation 0x000000010a27cb28 _CF_forwarding_prep_0 + 120
5 MyApp 0x0000000107115ec1 -[FIRNetwork postURL:payload:queue:usingBackgroundSession:completionHandler:] + 331
6 MyApp 0x000000010710b053 -[FIRClearcutLogger sendNextPendingRequestWithCompletionHandler:] + 570
7 MyApp 0x000000010710aaf9 -[FIRClearcutLogger sendLogsWithCompletionHandler:] + 447
8 libdispatch.dylib 0x000000010a9edef9 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x000000010aa0e49b _dispatch_client_callout + 8
10 libdispatch.dylib 0x000000010a9f4988 _dispatch_queue_drain + 2215
11 libdispatch.dylib 0x000000010a9f3ea9 _dispatch_queue_invoke + 601
12 libdispatch.dylib 0x000000010a9f6af2 _dispatch_root_queue_drain + 1420
13 libdispatch.dylib 0x000000010a9f6561 _dispatch_worker_thread3 + 111
14 libsystem_pthread.dylib 0x000000010ad3f712 _pthread_wqthread + 1299
15 libsystem_pthread.dylib 0x000000010ad3f1ed start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
根据其他答案,我已在项目中设置了-ObjC
并定位了Other Linker Flags
,但我仍然遇到此错误。
有人可以提供建议吗?
答案 0 :(得分:0)
[FIRApp configure];
它必须在applicationDidFinishLaunching方法中。您无法在init和alloc appdelegate之后对其进行配置,因为应用程序尚未完成启动。