Firebase崩溃.. iOS Swift

我的Firebase iOS应用程序由于某种原因在cocoapods中必须手动添加框架。

我一直在崩溃错误说

2016-06-04 00:48:51.356 NewFirebase[74218:11918327] Configuring the default app. 2016-06-04 00:48:51.401 NewFirebase[74218:11918425] +[NSData gtm_dataByGzippingData:]: unrecognized selector sent to class 0x10bdd8110 2016-06-04 00:48:51.403 NewFirebase[74218:] <FIRAnalytics/INFO> Firebase Analytics v.3200000 started 2016-06-04 00:48:51.404 NewFirebase[74218:11918425] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSData gtm_dataByGzipping 

我把唯一的线与firebase相关的是

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. FIRApp.configure() FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) return true } 

其他有关Facebook的login我要把firebase

这些是其中的框架 构架

这是链接器部分在构build设置中的样子 链接器标志部分

如果你想要更多的代码,请随时留言

如果我摆脱FIRApp.configure()一切正常,因为它应该是..

我在OS X 10.11.5上使用了针对iOS 9.3的Xcode 7.3.1。

我有与“未定义符号”问题完全相同的问题。

我首先清空“其他链接器标志”中的所有内容,然后将$(OTHER_LDFLAGS)和-ObjC添加为2个单独项目(双击时使用+button)。

我做的另一件事是删除框架给我的问题 – GoogleUtilities和FirebaseAnalytics。

然后我使用“添加文件到项目”选项一次添加它们,并确保它们被定位到我的iOS应用程序。

之后,构build成功,广告展现。

您需要添加这些库

  • 的libc ++。TBD
  • libsqlite3.tbd
  • AddressBook.framework

链接二进制文件与库

转到目标 – >build立阶段

http://i.stack.imgur.com/BpZWD.jpg

在其他链接器标志中添加两个参数

 $(inherited) -ObjC 

在这里输入图像说明

我只是失去了几个小时 – 自述和文件是非常糟糕的

您还需要包含GoogleToolboxForMac.framework,我错过了这个,因为我认为它是针对mac应用程序的,但是将其添加到修复问题中。

回答上面的评论:

编辑:这是我的Build Settings看起来像:

Firebase目录中的README.md表示将Firebase.h文件拖放到项目以及module.modulemap文件中,并将module.modulemap文件的path添加到User Header Search Paths在这里输入图像说明

Firebase目录中的README.md说在这里只input-ObjC: 在这里输入图像说明

这是我的Project Navigator看起来像: 在这里输入图像说明

 Ld /Users/7stud/Library/Developer/Xcode/DerivedData/FirebaseApplicationExample-ewixbbawksqkuaaqeeobeaexeirc/Build/Products/Debug-iphonesimulator/FirebaseApplicationExample.app/FirebaseApplicationExample normal x86_64 cd /Users/7stud/xcode_projects/iOS/FirebaseApplicationExample export IPHONEOS_DEPLOYMENT_TARGET=9.2 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk -L/Users/7stud/Library/Developer/Xcode/DerivedData/FirebaseApplicationExample-ewixbbawksqkuaaqeeobeaexeirc/Build/Products/Debug-iphonesimulator -F/Users/7stud/Library/Developer/Xcode/DerivedData/FirebaseApplicationExample-ewixbbawksqkuaaqeeobeaexeirc/Build/Products/Debug-iphonesimulator -F/Users/7stud/xcode_projects/iOS/FirebaseApplicationExample/FirebaseApplicationExample -filelist /Users/7stud/Library/Developer/Xcode/DerivedData/FirebaseApplicationExample-ewixbbawksqkuaaqeeobeaexeirc/Build/Intermediates/FirebaseApplicationExample.build/Debug-iphonesimulator/FirebaseApplicationExample.build/Objects-normal/x86_64/FirebaseApplicationExample.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=9.2 -Xlinker -objc_abi_version -Xlinker 2 -ObjC -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/7stud/Library/Developer/Xcode/DerivedData/FirebaseApplicationExample-ewixbbawksqkuaaqeeobeaexeirc/Build/Intermediates/FirebaseApplicationExample.build/Debug-iphonesimulator/FirebaseApplicationExample.build/Objects-normal/x86_64/FirebaseApplicationExample.swiftmodule -framework FirebaseDatabase -framework GoogleInterchangeUtilities -framework FirebaseAnalytics -framework GoogleSymbolUtilities -framework GoogleUtilities -framework FirebaseInstanceID -Xlinker -dependency_info -Xlinker /Users/7stud/Library/Developer/Xcode/DerivedData/FirebaseApplicationExample-ewixbbawksqkuaaqeeobeaexeirc/Build/Intermediates/FirebaseApplicationExample.build/Debug-iphonesimulator/FirebaseApplicationExample.build/Objects-normal/x86_64/FirebaseApplicationExample_dependency_info.dat -o /Users/7stud/Library/Developer/Xcode/DerivedData/FirebaseApplicationExample-ewixbbawksqkuaaqeeobeaexeirc/Build/Products/Debug-iphonesimulator/FirebaseApplicationExample.app/FirebaseApplicationExample Undefined symbols for architecture x86_64: "_ABAddressBookAddRecord", referenced from: -[GSDK_GTMABAddressBook addRecord:] in GoogleUtilities(GTMABAddressBook.o) "_ABAddressBookCopyArrayOfAllGroups", referenced from: -[GSDK_GTMABAddressBook groups] in GoogleUtilities(GTMABAddressBook.o) "_ABAddressBookCopyArrayOfAllPeople", referenced from: -[GSDK_GTMABAddressBook people] in GoogleUtilities(GTMABAddressBook.o) "_ABAddressBookCopyLocalizedLabel", referenced from: +[GSDK_GTMABAddressBook localizedLabel:] in GoogleUtilities(GTMABAddressBook.o) "_ABAddressBookCopyPeopleWithName", referenced from: -[GSDK_GTMABAddressBook peopleWithCompositeNameWithPrefix:] in GoogleUtilities(GTMABAddressBook.o) "_ABAddressBookCreateWithOptions", referenced from: -[GSDK_GTMABAddressBook init] in GoogleUtilities(GTMABAddressBook.o) "_ABAddressBookGetGroupWithRecordID", referenced from: -[GSDK_GTMABAddressBook groupForId:] in GoogleUtilities(GTMABAddressBook.o) "_ABAddressBookGetPersonWithRecordID", referenced from: -[GSDK_GTMABAddressBook personForId:] in GoogleUtilities(GTMABAddressBook.o) "_ABAddressBookHasUnsavedChanges", referenced from: -[GSDK_GTMABAddressBook hasUnsavedChanges] in GoogleUtilities(GTMABAddressBook.o) "_ABAddressBookRemoveRecord", referenced from: -[GSDK_GTMABAddressBook removeRecord:] in GoogleUtilities(GTMABAddressBook.o) "_ABAddressBookSave", referenced from: -[GSDK_GTMABAddressBook save] in GoogleUtilities(GTMABAddressBook.o) "_ABGroupAddMember", referenced from: -[GSDK_GTMABGroup addMember:] in GoogleUtilities(GTMABAddressBook.o) "_ABGroupCopyArrayOfAllMembers", referenced from: -[GSDK_GTMABGroup members] in GoogleUtilities(GTMABAddressBook.o) "_ABGroupCreate", referenced from: -[GSDK_GTMABGroup init] in GoogleUtilities(GTMABAddressBook.o) "_ABGroupRemoveMember", referenced from: -[GSDK_GTMABGroup removeMember:] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueAddValueAndLabel", referenced from: -[GSDK_GTMABMutableMultiValue addValue:withLabel:] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueCopyLabelAtIndex", referenced from: -[GSDK_GTMABMultiValue labelAtIndex:] in GoogleUtilities(GTMABAddressBook.o) -[GSDK_GTMABMultiValueEnumerator nextObject] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueCopyValueAtIndex", referenced from: -[GSDK_GTMABMultiValue valueAtIndex:] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueCreateMutable", referenced from: -[GSDK_GTMABMutableMultiValue initWithPropertyType:] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueCreateMutableCopy", referenced from: -[GSDK_GTMABMutableMultiValue initWithMultiValue:] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueGetCount", referenced from: -[GSDK_GTMABMultiValue count] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueGetIdentifierAtIndex", referenced from: -[GSDK_GTMABMultiValue identifierAtIndex:] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueGetIndexForIdentifier", referenced from: -[GSDK_GTMABMultiValue indexForIdentifier:] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueGetPropertyType", referenced from: -[GSDK_GTMABMultiValue propertyType] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueInsertValueAndLabelAtIndex", referenced from: -[GSDK_GTMABMutableMultiValue insertValue:withLabel:atIndex:] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueRemoveValueAndLabelAtIndex", referenced from: -[GSDK_GTMABMutableMultiValue removeValueAndLabelAtIndex:] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueReplaceLabelAtIndex", referenced from: -[GSDK_GTMABMutableMultiValue replaceLabelAtIndex:withLabel:] in GoogleUtilities(GTMABAddressBook.o) "_ABMultiValueReplaceValueAtIndex", referenced from: -[GSDK_GTMABMutableMultiValue replaceValueAtIndex:withValue:] in GoogleUtilities(GTMABAddressBook.o) "_ABPersonCopyImageData", referenced from: -[GSDK_GTMABPerson imageData] in GoogleUtilities(GTMABAddressBook.o) "_ABPersonCopyLocalizedPropertyName", referenced from: +[GSDK_GTMABPerson localizedPropertyName:] in GoogleUtilities(GTMABAddressBook.o) "_ABPersonCreate", referenced from: -[GSDK_GTMABPerson init] in GoogleUtilities(GTMABAddressBook.o) "_ABPersonGetCompositeNameFormat", referenced from: +[GSDK_GTMABPerson compositeNameFormat] in GoogleUtilities(GTMABAddressBook.o) "_ABPersonGetTypeOfProperty", referenced from: +[GSDK_GTMABPerson typeOfProperty:] in GoogleUtilities(GTMABAddressBook.o) "_ABPersonRemoveImageData", referenced from: -[GSDK_GTMABPerson setImageData:] in GoogleUtilities(GTMABAddressBook.o) "_ABPersonSetImageData", referenced from: -[GSDK_GTMABPerson setImageData:] in GoogleUtilities(GTMABAddressBook.o) "_ABRecordCopyCompositeName", referenced from: -[GSDK_GTMABPerson compositeName] in GoogleUtilities(GTMABAddressBook.o) -[GSDK_GTMABGroup compositeName] in GoogleUtilities(GTMABAddressBook.o) "_ABRecordCopyValue", referenced from: -[GSDK_GTMABRecord valueForProperty:] in GoogleUtilities(GTMABAddressBook.o) "_ABRecordGetRecordID", referenced from: -[GSDK_GTMABRecord recordID] in GoogleUtilities(GTMABAddressBook.o) "_ABRecordRemoveValue", referenced from: -[GSDK_GTMABRecord removeValueForProperty:] in GoogleUtilities(GTMABAddressBook.o) "_ABRecordSetValue", referenced from: -[GSDK_GTMABRecord setValue:forProperty:] in GoogleUtilities(GTMABAddressBook.o) "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(char const*) const", referenced from: leveldb::VersionSet::Recover() in FirebaseDatabase(version_set.o) "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from: void std::__1::vector<std::__1::pair<int, leveldb::FileMetaData>, std::__1::allocator<std::__1::pair<int, leveldb::FileMetaData> > >::__push_back_slow_path<std::__1::pair<int, leveldb::FileMetaData> const>(std::__1::pair<int, leveldb::FileMetaData> const&) in FirebaseDatabase(db_impl.o) void std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> >::__push_back_slow_path<unsigned long long const>(unsigned long long const&) in FirebaseDatabase(db_impl.o) void std::__1::vector<leveldb::DBImpl::CompactionState::Output, std::__1::allocator<leveldb::DBImpl::CompactionState::Output> >::__push_back_slow_path<leveldb::DBImpl::CompactionState::Output const>(leveldb::DBImpl::CompactionState::Output const&) in FirebaseDatabase(db_impl.o) void std::__1::vector<leveldb::Iterator*, std::__1::allocator<leveldb::Iterator*> >::__push_back_slow_path<leveldb::Iterator* const>(leveldb::Iterator* const&) in FirebaseDatabase(db_impl.o) ... ... "_utf8_nextCharSafeBody", referenced from: -[FSRWebSocket _innerPumpScanner] in FirebaseDatabase(FSRWebSocket.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Showing first 200 notices only 

添加这个链接器标志解决了我的问题。 我曾尝试过使用CocoaPods,但无法导入任何更具体的Firebase模块。 添加直接工作的框架,但只有添加了-ObjC链接器标志。

我只是从另一个项目拖动代码文件和框架,并遇到这个问题。 在构build阶段添加所有框架之后,在“其他链接器标记”中添加-ObjC解决了这个问题。

我通过从我的项目中删除FirebaseNanoPBFirebaseCoreDiagnostics框架解决了此问题。