Skip to content

Swift 3 - CocoaPods Integration Issues #300

Closed
@Chris-Corea

Description

@Chris-Corea

New Issue Checklist

  • I have looked at the Documentation
    I have read the F.A.Q.

Issue Info

Info Value
Platform e.g. ios
Platform Version e.g. 8.0
SnapKit Version e.g. 3.0.0
Integration Method e.g. cocoapods

Issue Description

Using Xcode 8 and Swift 3, my project fails to compile SnapKit and calls out 16 different issues (all but one are "Extraneous argument label 'some_label' in call").

For example, in Constraint.swift line 129 I see the following:

let layoutConstant: CGFloat = self.constant.constraintConstantTargetValueFor(layoutAttribute: layoutToAttribute)

Which shouldn't cause a compiler error because the most recent code in the 3.0 tag does explicitly call for an argument label in the constraintConstantTargetValueFor() method.

However, the code pulled down from a pod install differs from the code in the 3.0 tag as seen in GitHub. Here's the function signature I see in the Pod's ConstraintConstantTarget.swift file on line 45:

internal func constraintConstantTargetValueFor(_ layoutAttribute: NSLayoutAttribute) -> CGFloat

I'm not particularly familiar with CocoaPods, but it seems like the code isn't in sync.

Activity

robertjpayne

robertjpayne commented on Sep 15, 2016

@robertjpayne
Member

@Chris-Corea what version of Cocoapods are you using? And are your command line tools definitely pointed @ Xcode 8?

adhiravishankar

adhiravishankar commented on Sep 15, 2016

@adhiravishankar

I'm on XCode 8 and there are issues with the latest version of SnapKit and Xcode 8. Most of it is extraneous arguments.

robertjpayne

robertjpayne commented on Sep 15, 2016

@robertjpayne
Member

@adhiravishankar @Chris-Corea what may have happened is I did this release using Xcode 8 GM not Xcode 8 from app store and there may be some subtle difference.

I'm checking now.

robertjpayne

robertjpayne commented on Sep 15, 2016

@robertjpayne
Member

@adhiravishankar @Chris-Corea so I've triple checked and I can't reproduce this.

Can both of you please confirm:

Xcode Version

  1. Open Xcode
  2. Go Menu Bar -> Xcode -> About Xcode
  3. Ensure you are running latest App Store version 8.0 (8A218a)

Cocoapods Version

  1. Open Terminal
  2. Type pod --version
  3. Ensure you are running at least 1.1.0.rc.2

Project Swift Version

  1. Open Xcode Project
  2. Open Target Build Settings
  3. Find Use Legacy Swift Language Version
  4. Ensure this is NO for your target

Project Podfile.lock

  1. Open your Podfile.lock in a text editor
  2. Ensure you have SnapKit (3.0.0) under the PODS: section
HaijunWei

HaijunWei commented on Sep 15, 2016

@HaijunWei

Xcode Version 8.0(8A218a)
Cocoapods Version 1.0.1 (I tried to update, but no update)
Compile Error. It reminds me that I need to convert the swift version.

sahandnayebaziz

sahandnayebaziz commented on Sep 15, 2016

@sahandnayebaziz

@HaijunWei, since 1.1.0.rc.2 is an rc-version (release-candidate version), you can install it with this command:

sudo gem install cocoapods --pre

sahandnayebaziz

sahandnayebaziz commented on Sep 15, 2016

@sahandnayebaziz

If anybody gets here who is having issues pushing a Swift 3 update to a pod that has SnapKit as a dependency, I was getting similar compile errors only when trying pod spec lint and pod trunk push, while SnapKit was building fine with my framework in Xcode.

I was able to fix this by running echo "3.0" > .swift-version in my directory as a hint to cocoapods. This is discussed further here: CocoaPods/CocoaPods#5864

robertjpayne

robertjpayne commented on Sep 15, 2016

@robertjpayne
Member

@sahandnayebaziz ah that is how you fix the linter! I cheated and just disabled the lint check in the gem ruby code.

Mosaics

Mosaics commented on Sep 15, 2016

@Mosaics

what time will be support swift3.0?

robertjpayne

robertjpayne commented on Sep 15, 2016

@robertjpayne
Member

@Mosaics it's already supported, there's just some Cocoapods issues with installing dependencies. Nothing I can do for SnapKit to resolve that.

changed the title [-]Swift 3 CocoaPods Compile Errors[/-] [+]Swift 3 - CocoaPods Integration Issues[/+] on Sep 15, 2016
adhiravishankar

adhiravishankar commented on Sep 15, 2016

@adhiravishankar

I would hold off on renaming the issue just yet, I fixed my errors, but I might receive an update and it would get rid of it. I haven't had time yet to check it, but I'll highlight the issues I had as soon as I can.

adhiravishankar

adhiravishankar commented on Sep 15, 2016

@adhiravishankar

Also, all of those requirements did hold true.

robertjpayne

robertjpayne commented on Sep 15, 2016

@robertjpayne
Member

@adhiravishankar I'm pretty positive it's an issue with Cocoapods, I've checked on two computers with Xcode 8 and also Travis isn't complaining.

I'm going to leave this issue up for a bit because there will be many upgraders over the next few weeks that run into the same problem.

RamboLouis

RamboLouis commented on Sep 15, 2016

@RamboLouis

ad8aa195-88df-40cf-9548-af9df4e25562
qq20160915-0 2x
029fdb0d-ae93-4ce4-b776-3a716775580b
In the test project using Xcode 8 (8A218a) and cocoapods (1.0.1), integrated SnapKit (3.0.0) 272 compile errors.

16 remaining items

xx11dragon

xx11dragon commented on Sep 20, 2016

@xx11dragon

@robertjpayne Yes swift3.0, solution: target-Build Phases- add Copy Files "SnapKit.framework".hhh

robertjpayne

robertjpayne commented on Sep 20, 2016

@robertjpayne
Member

@xx11dragon weird, sounds like Cocoapods isn't integrating properly if the fix is to manually copy the framework. It should be doing that for you. 100% sure you are using v1.1.0.rc2? Ruby will allow multiple versions of the same gem to be installed.

xx11dragon

xx11dragon commented on Sep 20, 2016

@xx11dragon

@robertjpayne should be right...
2016-09-20 1 54 21

robertjpayne

robertjpayne commented on Sep 20, 2016

@robertjpayne
Member

@xx11dragon it should say 1.1.0.rc2 not beta.2

robertjpaynelocal:SnapKit robertjpayne$ pod --version
1.1.0.rc.2

You need to update!

xx11dragon

xx11dragon commented on Sep 20, 2016

@xx11dragon

@robertjpayne so sorry...

lifez

lifez commented on Sep 21, 2016

@lifez

@robertjpayne delete all pod and pod install again it work

Thank you for attention

jcdickman

jcdickman commented on Sep 29, 2016

@jcdickman

I have fixed by directly point to the git link within Podfile to fix the 16 errors.
Like that: pod 'SnapKit', :git => 'https://github.com/SnapKit/SnapKit.git'
I will change back after Cocoapods can have the least codes on their repository.

$ pod --version 1.0.1
Finally got SnapKit installed and the app building @kevinlee85 's way.

The other approach (using the rc version) I kept running into issues on pod install:

Setting up CocoaPods master repo
Unknown option: -C
usage: git [--version] [--exec-path[=]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=] [--work-tree=] [--namespace=]
[-c name=value] [--help]
[]
[!] Unable to add a source with url https://github.com/CocoaPods/Specs.git named master-1.
You can try adding it manually in ~/.cocoapods/repos or via pod repo add.

Manually cloning the cocoapod repo or using pod repo add didn't work either. Uninstalling cocoapods, reinstalling 1.0.1 and pointing to SnapKit repo in Podfile did the trick for me.

danielCarlosCE

danielCarlosCE commented on Oct 14, 2016

@danielCarlosCE

My class didn't have import SnapKit but it was working just fine. Suddenly it stopped working.

I tried everything above and didn't help. After adding the import, it worked =S

ssccsci

ssccsci commented on Nov 14, 2016

@ssccsci

@PlayLive it worked! thank u!:)

robertjpayne

robertjpayne commented on Apr 10, 2017

@robertjpayne
Member

Closing this becauseI believe this is now fixed.

justrick31

justrick31 commented on May 31, 2017

@justrick31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @robertjpayne@sahandnayebaziz@Chris-Corea@fangfeixiong@danielCarlosCE

        Issue actions

          Swift 3 - CocoaPods Integration Issues · Issue #300 · SnapKit/SnapKit