Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 9 fails to build Swift 4 project with pod

When attempting to build my Swift 4 project in Xcode 9 beta 2, some code signing error occurs after which the build of my app is discontinued.

The error that is shown in Xcode:

/usr/bin/codesign --force --sign -  --preserve-metadata=identifier,entitlements '/Users/nickgaens/Library/Developer/Xcode/DerivedData/Emprova_Swift-bbvmoytlhlbqpueyftstselvwhdj/Build/Products/Debug-iphonesimulator/Emprova GPS Swift.app/Frameworks/Alamofire.framework'
/Users/nickgaens/Library/Developer/Xcode/DerivedData/Emprova_Swift-bbvmoytlhlbqpueyftstselvwhdj/Build/Products/Debug-iphonesimulator/Emprova GPS Swift.app/Frameworks/Alamofire.framework: No such file or directory

Screenshot of Xcode error

As you might notice, the --sign argument is followed by a single - character.

My setup:

  • Xcode 9 beta 2 (9M137d) with its bundled Swift 4-version
  • Cocoapods v1.2.1 with Podfile
platform :ios, '10.0'

target 'Emprova GPS Demo Swift' do
  use_frameworks!

  pod 'Alamofire', '~> 4.5.0'
  pod 'AlamofireNetworkActivityIndicator', '~> 2.2.0'
  pod 'KeyClip'
  pod 'Localize-Swift', '~> 1.7.1'
  pod 'FMDB'

end

target 'Emprova GPS Swift' do
  use_frameworks!

  pod 'Alamofire', '~> 4.5.0'
  pod 'AlamofireNetworkActivityIndicator', '~> 2.2.0'
  pod 'KeyClip'
  pod 'Localize-Swift', '~> 1.7.1'
  pod 'FMDB'

end

  • I didn't change a single letter of any of the added pods files.
  • I opened Pods.xcodeproj to check and double check Build Settings - Code Signing Identitiy of the Alamofire pod/target, but it is set to Don't Code Sign.
  • I already checked my Keychain Access app to see if the Apple Worldwide Developer Relations Certification Authority wasn't expired (it isn't) and is marked as trusted (it is).
  • I already emptied the DerivedData directory multiple times (~/Library/Developer/Xcode/DerivedData) and performed a Clean (both via Cmd+K and Cmd+Alt+Shift+K to no avail.
  • I already attempted to set the Xcode 'Command Line Tools' (Preferences - Locations - Command Line Tools) to both Xcode 8.3.3 (8E3004b) and Xcode 9.0 (9M137d) to no avail.

Completely ran out of ideas after having spent multiple hours searching for a solution. Does anyone have a clue why Xcode 9 no longer builds my project?

Also, link to my issue on Alamofires GitHub page, for the sake of completeness: #2183.

like image 547
Nick Gaens Avatar asked Jun 27 '17 13:06

Nick Gaens


People also ask

What is the pods folder in Xcode?

The Podfile is a specification that describes the dependencies of the targets of one or more Xcode projects. The file should simply be named Podfile .


1 Answers

I found out what's wrong! Xcode continued using the .xcodeproj file to open my project when selecting it on the welcome screen, but Cocoapods requires the .xcworkspace file to be used! There's a visual distinction between both entries on Xcode's Welcome screen afterwards: difference between Xcode workspace and project on Welcome screen.

Opening the workspace shows two projects in Xcode's Project Navigator: one for my app and a second one named Pods, which embodies all installed pods. Building the app no longer shows weird build errors.

like image 123
Nick Gaens Avatar answered Nov 10 '22 18:11

Nick Gaens