Firebase Crash.. iOS Swift

前端 未结 8 1117
野的像风
野的像风 2020-12-17 00:04

My Firebase iOS App i had to put the frameworks in manually due to some reason in cocoapods.

i have been getting an crash error saying

2016-06-04 00         


        
相关标签:
8条回答
  • 2020-12-17 00:32

    I am using Xcode 7.3.1 targeting iOS 9.3 on OS X 10.11.5.

    I had the exact same issue as above with the "Undefined symbols" issue.

    I first emptied everything from the "Other Linker Flags" and then added $(OTHER_LDFLAGS) and -ObjC as 2 separate items (using the + button when you double click).

    The other thing I did was remove the frameworks giving me issues - GoogleUtilities and FirebaseAnalytics.

    I then added them back in using the "Add files to Project" option one at a time and ensured they are targeted to my iOS app.

    The build was successful after that and ads show up.

    0 讨论(0)
  • 2020-12-17 00:34

    You need to add these libraries

    • libc++.tbd
    • libsqlite3.tbd
    • AddressBook.framework

    to Link Binary With Libraries.

    Go to Targets -> Build Phases

    0 讨论(0)
  • 2020-12-17 00:35

    add two parameter in Other Linker Flags

    $(inherited)
    -ObjC
    

    0 讨论(0)
  • 2020-12-17 00:37

    Answer for comment above:

    Edit: Here is what my Build Settings look like:

    The README.md in the Firebase directory said to drag the Firebase.h file into the project, as well as the module.modulemap file and add the path to the module.modulemap file to the User Header Search Paths:

    The README.md in the Firebase directory said to enter merely -ObjC here:

    Here is what my Project Navigator looks like:

    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
    
    0 讨论(0)
  • 2020-12-17 00:48

    Adding this linker flag fixed the problem for me. I had tried using CocoaPods first, but couldn't get it to import any of the more specific Firebase modules. Adding the frameworks directly worked, but only if the -ObjC linker flag was added.

    0 讨论(0)
  • 2020-12-17 00:50

    I fixed this issue by removing FirebaseNanoPB and FirebaseCoreDiagnostics framework from my project.

    0 讨论(0)
提交回复
热议问题