CocoaPods lint failing with Xcode 8

Filipe Alvarenga
3 min readSep 27, 2016

--

A fast tip for you that is suffering converting your project to Swift 3.

Yesterday I was converting some of my projects to Swift 3. My priority was filipealva/PickerView which had a pending enhancement pull request and before I could merge it I received another pull request making the Swift 3 conversion for me, then I merged it with the first one, resolved the issues and everything was done with less effort than I imagined it would take: Thanks to the awesome people contributing (Thanks Phill and Nik for your contributions o/) I just needed to update the Podspec and update it. Open source is such an amazing thing!

So far, so good…

I've made the updates to Podspec and then runned the pod lib lint command and this is what I got:

WTF!? 121 errors? 19 warnings? I just build it with success some seconds ago in Xcode u.u

Then I runned with the --no-clean option, which generates a workspace where I could inspect and find the problem. The problem? I found none. Obviously it was time to ask Mr. Google about it, and it brought me this GitHub issue. I discovered there that I was not the only one suffering with this issue and the better part: The CocoaPods team had already released a new version that solved it 😍.

In order to fix the issue I should add a .swift-version file to my project directory with the Swift version I was using inside (in my case 3.0), update CocoaPods to 1.1.0.rc.2 version and everything would works fine, right? Wrong! In fact the errors and warnings decreased but I still couldn't build it successful through pod lib lint.

BUT WHY?

How I fixed it

Well, if you read until here maybe the solutions above were not able to completely fix your problem too. The real problem to me was that I still had the Xcode 7 installed, so CocoaPods were using it to build my Swift 3 project which obviously would never happen.

If you already added the .swift-version file and updated your CocoaPods version but are still getting the issues when running pod lib lint you may try run the sudo xcode-select --switch /pathToYour/Xcode8.app/ command (it changes the default Xcode version to the one you've informed in the path) before you run pod lib lint again, then CocoaPods will use the correct version of Xcode, in this case Xcode 8, to build your project during the lint process.

Hope you find it useful somehow. If so, you could say it in the comments, tap in the heart below and spread the word sharing it with your friends ❤

--

--

Filipe Alvarenga

Formely co-founder at Planejei.com, currently iOS Software Engineer at Rocket.Chat ,entrepreneur & iOS developer