4

I have many pods installed in my project. Everything worked fine since my last pod update. After last pod update, I have 28 build errors starting with "Could not build module xxx".

enter image description here

Here is my podfile:

target 'projectXXX' do
use_frameworks!
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'Firebase/Messaging'
pod 'Firebase/Crash'
pod 'TwitterKit'
pod 'Fabric'
pod 'Crashlytics' end
  • I tried to uninstall - install cocoapods.
  • I tried to deintegrate pod from project, install, remove .workspace file and deriveData folder... still got these errors.

I'm running out of ideas. Please, any other solution? Thanks you very much

EDIT

I have just discovered that my Pods.framework is in red state as visible on screenshot below. Maybe this can help?

enter image description here

GrayFox
  • 824
  • 2
  • 10
  • 27
  • do you have this at the top of the Podfile `source 'https://github.com/CocoaPods/Specs.git'` – zombie Nov 21 '17 at 14:56
  • Did you try to clean the build folder? – Tamás Sengel Nov 21 '17 at 14:57
  • check your platform version. give 8.2 and above – Alwin Nov 21 '17 at 15:13
  • @Alwin : this is Xcode 9.0 and deployment target iOS 9.0. – GrayFox Nov 21 '17 at 15:22
  • @the4kman yes I try to clean build folder and delete Derived Data folder. – GrayFox Nov 21 '17 at 15:23
  • @zombie I have never seen we should add this line! However I tried but did not change the result – GrayFox Nov 21 '17 at 15:24
  • If you have no concern, try reinstalling Xcode or install another version of Xcode and open the project again. – chengsam Nov 21 '17 at 15:44
  • Check swift version for each pod module. – woosiki Nov 21 '17 at 16:13
  • @chengsam : Xcode seems fine because when I open back my project archive built with previous cocoapods version, Xcode can build my project. So the error does not come from Xcode but my pods config. – GrayFox Nov 22 '17 at 08:50
  • @woosiki : they are all set to Swift 4.0. Thanks all for your concern ;) – GrayFox Nov 22 '17 at 08:50
  • @GrayFox how are you importing the FBSDKLoginKit dependency in your project? – Massimiliano Del Maestro Nov 24 '17 at 14:09
  • @MassimilianoDelMaestro frameworks has been downloaded months ago and added manually to project. Then I added to Linked Frameworks and Libraries. It worked well with previous project version (until pod update). – GrayFox Nov 24 '17 at 15:52
  • @MassimilianoDelMaestro I updated my question with a screenshot of my Frameworks configuration. – GrayFox Nov 24 '17 at 16:00
  • Did you check ? – Reinhard Männer Nov 27 '17 at 08:57
  • What's your Swift version? Are all the pods compatible with your current Swift Version? You should "block" the versions for your pods (doing `'~> 3.0'`). If you use a Git (or any versioning system), you should be able to see the `Podfile.lock` where all the previous previous are stated, and find the culprit that got updated by that you don't support. – Larme Nov 30 '17 at 13:22
  • I know these pods are compatible with the latest swift 4 syntax, as long as they are updated properly. Perhaps remove all pods from your podfile, run pod update, then add the pods back to your podfile, then pod update again. Clean your project, delete it from your device/simulator and build it again. – Cody Potter Dec 01 '17 at 02:14

5 Answers5

1

First try to remove cocoa pods completely

gem install cocoapods-deintegrate
pod deintegrate
gem install cocoapods-clean
pod clean

Then install again like this

pod setup
open -a Xcode Podfile

In Pod file add like this

# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'TestProject' do
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'Firebase/Messaging'
pod 'Firebase/Crash'
pod 'TwitterKit'
pod 'Fabric'
pod 'Crashlytics'
end
target 'ProjectTests' do
end

pod install
Uma Madhavi
  • 4,851
  • 5
  • 38
  • 73
0

Updating Xcode can resolve this issue. Thing is, pods might support multiple swift versions, so pods should be able to specify a range of swift versions.

Before Updating check if PODS_ROOT user-definer value in Build Settings of target is not deleted may be accidently. If so Try to add PODS_ROOT=${SRCROOT}/Pods

hood
  • 65
  • 1
  • 9
0

It's possible that you use old pods repositories and after update (that was few month ago) you need to specify which pod repository to use. I suggest that you need old one. See how looks my pod file for old project:

source 'https://github.com/CocoaPods/Old-Specs.git'

platform :ios, '9.0'
use_frameworks!

xcodeproj 'SF'

#link_with 'SF'

target 'SF' do
    pod 'TransitionKit'
    pod 'MBProgressHUD'
    pod 'PureLayout'
    pod 'UICountingLabel'
    pod 'MWPhotoBrowser', :git => 'https://github.com/pash3r/MWPhotoBrowser.git', :branch => 'skyFlyWork'
end
Nosov Pavel
  • 1,571
  • 1
  • 18
  • 34
0

Shen you are doing pod update which update all libraries most of the libraries on swift4 still some of them in swift3

If libraries are in swift 4 and your project in swift 3.2 you have two possibilities

  1. you can migrate project to swift4

(or)

  1. you need to rollback to the swift 3.2 supported pods

If project in swift4 libraries in swift3 you need to migrate those libraries into swift4 to solve current problem

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Ganesh Manickam
  • 2,113
  • 3
  • 20
  • 28
  • Hello Ganesh and thank you. My project is already in swift 4. I also checked my Pod project targets and are all in swift 4 too. However I can't see used swift version for target Pods-myproject – GrayFox Nov 29 '17 at 13:40
0

What could cause the issue:
- Breaking changes in Pods/APIs
- Breaking changes due to support/non-support of Swift versions

If you are using a versioning system (Git, etc.). Retrieve an older version of Podfile.lock.

Read that file (it's a text file, you can do more somePath/Podfile.lock in Terminal.app), and the "explicit" versions of your pods should be there.

You should get something like:

PODS:
  - GSKStretchyHeaderView (1.0.3)
  - Masonry (1.1.0)
...
PODFILE CHECKSUM: someCheckSum

COCOAPODS: 1.1.1

When you do pod 'Firebase' you don't specify a version, so you should get the last one. But if some versions are not compatible, you can get issues.

So you may add the '~> 1.0.3' (for instance if I take my example of GSKStretchyHeaderView). More informations on how to use it here.

So this way you should get back on a older version when everything was working. Now, you can check the documentation of each pods (and their respective podspec looking for "hidden" dependencies) and update them one by one checking which one is the culprit, and then maybe rising a flag (an issue) on their repo/git if needed.

For next dev, I'd suggest to set "version", to at least majors using the "optimistic operator ~>". If they respect the rules of versions, (major/minor/patch), then at least determine the major/minor, a patch shouldn't break anything, but fix things. A minor may have breaking change, while a major has a lot of probability to not be compatible with previous work (different declaration, classes renames, etc.).

If you don't use a versioning system like Git, I STRONGLY suggest you do now. But if that's your case and you still have the issue. Remember a date when everything was working fine after a pod update/install. Then, go to each Git of your pods, and read the history to find the version at that date and set that version in your podfile for that pod.

Larme
  • 24,190
  • 6
  • 51
  • 81