Cocoapods: pod lib lint failing with xcodebuild issues, using Xcode 8.1

Created on 21 Nov 2016  ·  34Comments  ·  Source: CocoaPods/CocoaPods

Report

What did you do?

pod lib lint --verbose

What did you expect to happen?

lint successful

What happened instead?

getting xcodebuild issues like

  • extraneous argument label
  • error: use of unresolved identifier 'UserDefaults'

    • error: use of unresolved identifier 'UserDefaults'

But i am able to run/build in xcode interface. Using Swift 3, also added the file .swift-version

CocoaPods Environment

ℹ Please replace this with the output of pod env.

Stack

   CocoaPods : 1.1.1
        Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
    RubyGems : 2.0.14.1
        Host : Mac OS X 10.11.6 (15G1108)
       Xcode : 8.1 (8T61a)
         Git : git version 2.9.3 (Apple Git-75)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.1.1
cocoapods-try         : 1.1.0

Project that demonstrates the issue

ℹ private cocoapod

defect

Most helpful comment

yes its showing
Xcode 8.1
Build version 8T61a

and CLI tools are already installed.

So just for testing I changed Command Line Tools from Xcode 8.1 to Xcode 8.0 and all the errors are gone but gettinga new error.

- ERROR | [iOS] unknown: Encountered an unknown error (/usr/bin/xcrun simctl list -j devices

All 34 comments

Can you provide a sample project that reproduces the issue? Your environment looks to be in good shape, so there's nothing I can think of to recommend there unfortunately. Thanks!

Is there possibility that xcodebuild is using older version of Xcode or SDK before Swift 3? I am getting errors like
error: use of undeclared type 'Error'

I am able to build the project through Xcode interface.

That's quite possible! I would try running xcodebuild -version to ensure that your terminal set to use Xcode 8.1 as expected, and then you could try running xcode-select --install to ensure you have the most up-to-date CLI tools.

yes its showing
Xcode 8.1
Build version 8T61a

and CLI tools are already installed.

So just for testing I changed Command Line Tools from Xcode 8.1 to Xcode 8.0 and all the errors are gone but gettinga new error.

- ERROR | [iOS] unknown: Encountered an unknown error (/usr/bin/xcrun simctl list -j devices

It feels like something is wrong with your Xcode install. Can you try re-installing Xcode? I know that's a big ask, but I'm not sure what else to do at this point. That's what I'd be doing anyway.

sure, i"ll try that. Thanks for the help.

Deleted all the versions of Xcode and installed just Xcode 8.1, still getting the same error. :(

Hm. Okay. I'm out of ideas. If you can provide a sample project and podspec, that'd be much appreciated. Otherwise, I'm not sure what other suggestions I can give.

@saleemsangi did you mean you were still getting the simctl error?

@benasher44 Yes by using Xcode 8.0 Command Line Tools all the xcodebuild errors went away and was just getting simctl error.
Any thoughts on fixing simctl error?

This might sound silly, but have you tried restarting your machine? simctl requires one or more services to work properly, and I've resolved issues like this just by restarting.

Yes tried that too. :)

Seems like something is wrong with my project. Created a new Single View App, added podspec file and it passed the validation. I'll keep digging.

Great to hear! I'm going to close this, since it doesn't appear to be a CocoaPods issue. But, please keep us updated when you figure out what the issue is. Thanks for filing!

@benasher44 I changed my code from swift 3 to swift 2.3 and its passing the validation. Somehow xcodebuild is using swift 2.3 even though its set to Xcode 8.1.

You can try passing --swift-version=3.0.1 to pod lib lint for Xcode 8.1 to see if that helps.

@benasher44 By using --swift-version=3.0.1 all the xcodebuild errors are gone. 🗡

Now getting one more
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

* BUILD FAILED *

I have converted the project to swift 3 and have set the use legacy flag to NO in build settings.

YaY!!!

pod lib lint --swift-version=3.0 => passed validation
pod lib lint --swift-version=3.0.1 => gives SWIFT_VERSION error

Glad you got it working, and we appreciate you posting your solution! Thanks!

@benasher44

I am trying to push the pod to my personal repo
pod repo push MyPod MyPod.podspec --allow-warnings --verbose

but getting the swift 3 errors again.

passing --swift-version fixed the same issue in the pod lint.

You should be able to provide the same flag to pod repo push. Will it not allow you to do that?

It gives me an error
[!] Unknown option: --swift-version=3.0

and provides the list of options available

Hm. That's probably an oversight. And the .swift-version file still doesn't work? It's contents should just be "3.0" without quotes (i.e. not SWIFT_VERSION=3.0 or anything like that). I'll tag this ticket as a defect though, since pod repo push should definitely allow --swift-version

So I already have .swift-version file and it has 3.0 in there.
pod lib lint was failing even with .swift-version file until I passed --swift-version in the terminal

Can i see the contents of your .swift-version file (cat .swift-version)?

2.3

I think I had changed from 3.0 to 2.3 for testing and forgot.

Now updated it to 3.0 and its working. I should have checked it. :(

You can close the issue anytime you want. Thank you for all the help.

No problem thank you!

Note for others that want to contribute: follow up here is to ensure pod trunk push and pod repo push accept the --swift-version arg.

@benasher44 I believe pod trunk push already supports this argument, I opened up a PR for pod repo push command

Closing via #6288

xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
) during validation.

[!] ContactsWrapper did not pass validation, due to 1 error.
[!] The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a .swift-version file to set the version for your Pod. For example to use Swift 2.3, run:
echo "2.3" > .swift-version.

You can use the --no-clean option to inspect any issue.

I solved this problem by entering

Xcode > Preferences > Locations
And assigning the Command Line Tools

Hi @yangweicong! Thanks for letting us know! It appears simctl isn't installed properly or isn't in your PATH. You should check to make sure your CLI tools are setup properly (run xcode-select --install and to ensure you're using an up-to-date version of Xcode. If you're still experiencing this issue, I recommend posting in Stackoverflow, as this doesn't appear to be an issue we could fix by patching CocoaPods. If you disagree, I recommend opening a new issue and fully filling out the issue template. Have a great day!

@benasher44 OK

swift-version does the trick for Swift 4 too:

pod trunk push --swift-version=4.0
Was this page helpful?
0 / 5 - 0 ratings