GrayFox
GrayFox

Reputation: 814

Many build errors after pod update

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

Upvotes: 4

Views: 3914

Answers (5)

Ganesh Manickam
Ganesh Manickam

Reputation: 2139

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

Upvotes: 0

Uma Madhavi
Uma Madhavi

Reputation: 4917

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

Upvotes: 1

Larme
Larme

Reputation: 26006

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.

Upvotes: 0

Nosov Pavel
Nosov Pavel

Reputation: 1571

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

Upvotes: 0

hood
hood

Reputation: 65

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

Upvotes: 0

Related Questions