Many build errors after pod update

假如想象 提交于 2019-12-10 15:36:09

问题


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".

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?


回答1:


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




回答2:


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



回答3:


when 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)

2) 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




回答4:


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.




回答5:


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


来源:https://stackoverflow.com/questions/47416029/many-build-errors-after-pod-update

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!