Aryan Kashyap
Aryan Kashyap

Reputation: 121

Firebase Crash.. iOS Swift

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: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

The only line i have put related to firebase is

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
    }

other is related to facebook login i am gonna put with firebase

These are the frameworks in it Frameworks

This is what the linker section looks like in the build settings Linker Flags Section

Please feel free if you want any more code

if i get rid of FIRApp.configure() Everything works fine as its supposed to be ..

Upvotes: 7

Views: 6216

Answers (8)

Dima Mi
Dima Mi

Reputation: 159

You need to add these libraries

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

to Link Binary With Libraries.

Go to Targets -> Build Phases

Upvotes: 15

BabyPanda
BabyPanda

Reputation: 1592

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

Upvotes: 0

user1039695
user1039695

Reputation: 1061

I was just dragging code files and frameworks from another project and encountered this problem. After adding all frameworks in build phase, adding -ObjC in 'other linker flags' solved the problem.

Upvotes: 0

user499846
user499846

Reputation: 721

I just lost hours to this - the readme and documentation is really poor

You also need to include the GoogleToolboxForMac.framework I missed this out as I assumed it was for mac apps, but adding it in fixed the problem.

Upvotes: 3

Shawn Tolidano
Shawn Tolidano

Reputation: 196

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.

Upvotes: 3

Laura
Laura

Reputation: 431

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.

Upvotes: 0

7stud
7stud

Reputation: 48659

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: enter image description here

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

Here is what my Project Navigator looks like: enter image description here

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

Upvotes: 1

Pratik
Pratik

Reputation: 433

add two parameter in Other Linker Flags

$(inherited)
-ObjC

enter image description here

Upvotes: 7

Related Questions