4

Everything was working fine till I got my mac formatted. After formatting it (Moved from El Capitan to Sierra), I cloned the repository, installed Cocoapods, did pod update. And everything got messed up with pods. I cannot build the application. The error is with Cocoapods (I think so). The error is as follows:

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

I am using Xcode 8.0 and Swift 2.3, with Cocoapods 1.1.1.

My Podfile is:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'ProjectName' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Firebase Pods
  pod 'Firebase'
  pod 'Firebase/Messaging'
  pod 'Firebase/Auth'
  pod 'Firebase/Crash'

  # Google Pods
  pod 'Google/SignIn'
  pod 'Google/Analytics'

  # Crashlytics
  pod 'Fabric'
  pod 'Crashlytics'

  # Facebook
  # pod 'FacebookCore'

  # Pods for ProjectName

  target 'ProjectName Tests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'ProjectName UITests' do
    inherit! :search_paths
    # Pods for testing
  end
end

Also receiving warning regarding framework paths. That are as follows:

ld: warning: directory not found for option '-F/Users/<user>/Library/Developer/Xcode/DerivedData/<project-name>-ftvbhpamiyfzmwdfpxknyvpcypde/Build/Products/Debug-iphonesimulator/GTMOAuth2'

ld: warning: directory not found for option '-F/Users/<user>/Library/Developer/Xcode/DerivedData/<project-name>-ftvbhpamiyfzmwdfpxknyvpcypde/Build/Products/Debug-iphonesimulator/GTMSessionFetcher'

ld: warning: directory not found for option '-F/Users/<user>/Library/Developer/Xcode/DerivedData/<project-name>-ftvbhpamiyfzmwdfpxknyvpcypde/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
Ravi Sisodia
  • 776
  • 1
  • 5
  • 20
  • Possible duplicate of [ld: framework not found after pod install](https://stackoverflow.com/questions/40323326/ld-framework-not-found-after-pod-install) – えるまる Oct 01 '19 at 07:13

4 Answers4

19

Reopen your project by choosing .xcworkspace(not .xcodeproj), those 3 warnings and 1 error will be gone.

Jeffrey Neo
  • 3,693
  • 2
  • 26
  • 30
1

To resolve this issue make sure Build Active Architecture Only is set to No in your projects build settings. Also set Build Active Architecture Only to No in all Pod targets as shown in the attached screenshot.

enter image description here

Then clean and rebuild the project.

Vinay Kumar
  • 3,257
  • 1
  • 20
  • 19
1

I had this problem when I had a project name that included an apostrophe, causing CocoaPods to generate an invalid directory path for the GTMOAuth2 framework.

I fixed it by changing the project name and regenerating all the files.

Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302
0

As @jeffrey-neo says, its usually going to be workspace vs project related. My only addition to that is if you use BitRise to compile it in the cloud, you need to check the workflow app settings (see: http://devcenter.bitrise.io/ios/frequent-ios-issues/#cocoapods-missing-dependency-issue). It can default to using the project and not the workspace file.

Nick
  • 2,803
  • 1
  • 39
  • 59