OSX 添加 Firebase 库后应用程序无法编译

OSX application fails to compile after adding the Firebase Library

我正在构建一个带有弹出窗口的无窗口菜单栏应用程序(代理)。此应用程序需要与 Firebase 集成才能从此商店检索一些数据。 XCode 版本为 6.3。

安装最新版本的 cocoapods (0.38.2) 并创建 Podfile 后:

# Uncomment this line to define a global platform for your project
platform :osx, '10.10'
pod 'Firebase', '>= 2.3.3'

target 'dTrain-osx-agent' do

end

target 'dTrain-osx-agentTests' do

end

我收到以下构建失败错误:

    Ld /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug/dTrain-osx-agent.app/Contents/MacOS/dTrain-osx-agent normal x86_64
    cd /Users/user/Projects/interop/dtrain_osx/dTrain-osx-agent
    export MACOSX_DEPLOYMENT_TARGET=10.10
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -L/Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug -F/Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug -F/Users/user/Projects/interop/dtrain_osx/dTrain-osx-agent/Pods/Firebase -filelist /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Intermediates/dTrain-osx-agent.build/Debug/dTrain-osx-agent.build/Objects-normal/x86_64/dTrain-osx-agent.LinkFileList -Xlinker -rpath -Xlinker @executable_path/../Frameworks -mmacosx-version-min=10.10 -ObjC -lc++ -licucore -framework CFNetwork -framework Firebase -framework Security -framework SystemConfiguration -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -Xlinker -add_ast_path -Xlinker /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Intermediates/dTrain-osx-agent.build/Debug/dTrain-osx-agent.build/Objects-normal/x86_64/dTrain_osx_agent.swiftmodule -lPods -Xlinker -dependency_info -Xlinker /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Intermediates/dTrain-osx-agent.build/Debug/dTrain-osx-agent.build/Objects-normal/x86_64/dTrain-osx-agent_dependency_info.dat -o /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug/dTrain-osx-agent.app/Contents/MacOS/dTrain-osx-agent

ld: framework not found OpenGLES for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

编辑: XCode 升级到 6.4 (6E35b) 仍然面临问题

看起来这个问题是我们对 2.3.3 中构建 Firebase SDK 的方式进行了一些更改的结果。现在,请您使用 2.3.2 版本的 SDK,修改您的 Podfile 如下:

pod 'Firebase', '2.3.2'

与此同时,我们将调查并尝试在 SDK 的未来版本中修复此问题。一旦我们这样做,我会更新这个答案。

请注意,如果您使用 Swift 和 Firebase SDK 2.3.2,则需要使用桥接头将 Firebase 导入 swift 应用。

为此,请在您的项目中创建一个新的 Objective-C 文件。当系统提示您是否要包含桥接头时,请说“是”。然后,删除您创建的 .m 文件,只保留为您创建的 bridging-header.h 文件。将以下行添加到该文件:

#import <Firebase/Firebase.h>

如果在完成安装并添加 #import 后仍然出现错误。

试试这个。打开终端,然后 cd 到你的项目并输入 Pod Install,它会提示你,如果你想恢复或保留 XCode 版本,它会提示你说你的项目被另一个应用程序编辑了。选择还原。

这修正了我的错误。希望能帮到别人。