将 Firebase 与 Google Toolbox 一起用于 Mac 时出现未定义符号 Xcode 错误
Undefined symbols Xcode error when using Firebase with Google Toolbox for Mac
我有一个 iOS 项目,它使用 Firebase 和 Google Toolbox for Mac,它们是通过 Pods 添加的。我的 Podfile 如下:
target 'MyApp' do
pod 'GoogleToolboxForMac', '~> 2.1'
pod 'GTMSessionFetcher', '~> 1.1'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
end
当我在 Xcode 中构建项目时,出现此错误:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GTMLogger", referenced from:
objc-class-ref in FirebaseMessaging(GIPReachability_ae5504e4a6a28a1d8997c6f38e8bff8b.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
有人可以指教吗?从其他类似问题来看,我可能需要在 Linked Frameworks and Libraries
中导入一个框架。我已经为 Firebase Messaging 添加了 UserNotifications.framework
,但不确定我还需要什么...?
看来您需要将 another Cocoapod 添加到您的 Podfile
:
target 'MyApp' do
pod 'GoogleToolboxForMac', '~> 2.1'
pod 'GTMSessionFetcher', '~> 1.1' # version 1.1 & newer up to - but not including - 2.0
pod 'gtm-logger', '>= 0.0.5' # version 0.0.5 or newer
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
end
然后是运行pod update
我有一个 iOS 项目,它使用 Firebase 和 Google Toolbox for Mac,它们是通过 Pods 添加的。我的 Podfile 如下:
target 'MyApp' do
pod 'GoogleToolboxForMac', '~> 2.1'
pod 'GTMSessionFetcher', '~> 1.1'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
end
当我在 Xcode 中构建项目时,出现此错误:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GTMLogger", referenced from:
objc-class-ref in FirebaseMessaging(GIPReachability_ae5504e4a6a28a1d8997c6f38e8bff8b.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
有人可以指教吗?从其他类似问题来看,我可能需要在 Linked Frameworks and Libraries
中导入一个框架。我已经为 Firebase Messaging 添加了 UserNotifications.framework
,但不确定我还需要什么...?
看来您需要将 another Cocoapod 添加到您的 Podfile
:
target 'MyApp' do
pod 'GoogleToolboxForMac', '~> 2.1'
pod 'GTMSessionFetcher', '~> 1.1' # version 1.1 & newer up to - but not including - 2.0
pod 'gtm-logger', '>= 0.0.5' # version 0.0.5 or newer
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
end
然后是运行pod update