Search code examples
iosswiftfirebasegeofirenanopb

Geofire (iOS) clang: error: linker command failed with exit code 1 (use -v to see invocation)


I'm using GeoFire (2.0.0) in the Swift project, after today's update pods when the project is going to Xcode shows clang: error: linker command failed with exit code 1 (use -v to see invocation) in the Geofire framework. Tell me, how can I fix this?

I install Geofire via Cocaopods as follows pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'

Update:

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

Update 1: When I install the pods I in the terminal can see that this component is used

Using nanopb (0.3.8)

Solution

  • I was advised here to solve this problem.

    I changed my firebase pods and it solved geofire problem. Interesting situation with subsequent updates, it turns out if you use Geofire it will not work to update Firebase on versions higher than 4.0.3

    # Firebase
        pod 'Firebase', '4.0.3'
        pod 'Firebase/Core'
        pod 'Firebase/Auth'
        pod 'Firebase/Database'
        pod 'Firebase/Storage'
        # Push notification
        pod 'Firebase/Core'
        pod 'Firebase/Messaging'
    

    Update: The second method. Need to write this in Podfile

    post_install do |installer|
      installer.pods_project.targets.each do |target|
      if target.name == 'GeoFire' then
        target.build_configurations.each do |config|
          config.build_settings['FRAMEWORK_SEARCH_PATHS'] = "#{config.build_settings['FRAMEWORK_SEARCH_PATHS']} ${PODS_ROOT}/FirebaseDatabase/Frameworks/ $PODS_CONFIGURATION_BUILD_DIR/GoogleToolboxForMac $PODS_CONFIGURATION_BUILD_DIR/nanopb"
          config.build_settings['OTHER_LDFLAGS'] = "#{config.build_settings['OTHER_LDFLAGS']} -framework FirebaseDatabase"
        end
      end
    end