Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 3 - CocoaPods Integration Issues #300

Closed
2 tasks done
Chris-Corea opened this issue Sep 14, 2016 · 40 comments
Closed
2 tasks done

Swift 3 - CocoaPods Integration Issues #300

Chris-Corea opened this issue Sep 14, 2016 · 40 comments
Labels

Comments

@Chris-Corea
Copy link

New Issue Checklist

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.

@robertjpayne
Copy link
Member

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

@adhiravishankar
Copy link

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
Copy link
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
Copy link
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
Copy link

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
Copy link

@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
Copy link

sahandnayebaziz commented Sep 15, 2016

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
Copy link
Member

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

@Mosaics
Copy link

Mosaics commented Sep 15, 2016

what time will be support swift3.0?

@robertjpayne
Copy link
Member

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

@robertjpayne robertjpayne changed the title Swift 3 CocoaPods Compile Errors Swift 3 - CocoaPods Integration Issues Sep 15, 2016
@adhiravishankar
Copy link

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
Copy link

Also, all of those requirements did hold true.

@robertjpayne
Copy link
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
Copy link

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.

@sahandnayebaziz
Copy link

@RamboLouis try updating to cocoapods 1.1.0.rc.2 with:

sudo gem install cocoapods --pre

@Chris-Corea
Copy link
Author

Chris-Corea commented Sep 15, 2016

@robertjpayne Thanks for the quick reply. After installing updating cocoapods to 1.1.0.rc.2 and clearing my cache with pod cache --all clean, I was able to pull down the latest (working!!) SnapKit code. I'll leave it up to you to whether you want to close this issue or leave it open.

Thanks for the help!

To reiterate:

  1. Update to Cocoapods to 1.1.0.rc.2
  2. Clear cocoapods' cache (can't hurt) with pod cache --all clean
  3. Delete the Podfile.lock (or modify it to call out v3.0.0)
  4. pod install

@RamboLouis
Copy link

@sahandnayebaziz Thank you. I'm trying.

@sahandnayebaziz
Copy link

@RamboLouis awesome. Ping back if you have any trouble

@robertjpayne
Copy link
Member

@Chris-Corea I'm going to leave this issue open for a little bit until Cocoapods gets their release out as its going to trip up a lot of people.

@kevinlee85
Copy link

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.

@Onetaway
Copy link

I got this error
constraint swift xcode today at 16 39 37

I have tried above methods, I wonder if your code has problem.

@robertjpayne
Copy link
Member

@Onetaway Can you please post up your Xcode version, Cocoapods version and project's Swift version?

I think a lot of people are having issues because they are trying to use the v3.0.0 with Swift 2.3.

@robertjpayne
Copy link
Member

@kevinlee85 curious why you had to pin it to master branch, what version of Cocoapods are you running?

@xx11dragon
Copy link

xx11dragon commented Sep 19, 2016

Simulator a Error

Project cash and log:

dyld: Library not loaded: @rpath/SnapKit.framework/SnapKit
Referenced from: /Users/loong/Library/Developer/CoreSimulator/Devices/B94193C1-FA8B-444C-9473-B7627DB3C4E9/data/Containers/Bundle/Application/DCC2E74D-54ED-4B4B-BC04-616A46CF0FB7/SwiftDemo.app/SwiftDemo
Reason: image not found

XcodeVersion: 8.0 (8A218a)
CocoapodsVersion: 1.1.0.beta.2
SnapKitVersion: 3.0.0
Project: NewProject
"Use Legacy Swift Language Version" set "NO"

@lifez
Copy link

lifez commented Sep 19, 2016

I got error like @Onetaway

https://puu.sh/rgl1k/43f4684095.png
https://puu.sh/rglgO/98245a5dca.png

Pod version: 1.1.0.rc.2
XcodeVersion: 8.0 (8A218a)
SnapKitVersion: 3.0.0

In SnapKit setting "Use Legacy Swift Language Version" set as "NO"

@fangfeixiong
Copy link

I use:
sudo gem install cocoapods --pre -n /usr/local/bin cocoa pods

then:
pod install

now it's ok!

@robertjpayne
Copy link
Member

@xx11dragon @lifez are both of you 100% sure your project is set to use Swift 3.0?

@lifez
Copy link

lifez commented Sep 20, 2016

@robertjpayne right i just convert to swift 3.0

@robertjpayne
Copy link
Member

@lifez and it still persists? Can you share your project by chance or too confidential? I can't repro this issue unless I'm running old Cocoapods. Can you triple check pod --version is showing 1.1.0.rc2?

@xx11dragon
Copy link

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

@robertjpayne
Copy link
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
Copy link

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

@robertjpayne
Copy link
Member

robertjpayne commented Sep 20, 2016

@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
Copy link

@robertjpayne so sorry...

@robertjpayne robertjpayne mentioned this issue Sep 20, 2016
3 tasks
@lifez
Copy link

lifez commented Sep 21, 2016

@robertjpayne delete all pod and pod install again it work

Thank you for attention

@jcdickman
Copy link

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
Copy link

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
Copy link

ssccsci commented Nov 14, 2016

@playlive it worked! thank u!:)

@robertjpayne
Copy link
Member

Closing this becauseI believe this is now fixed.

@justrick31
Copy link

justrick31 commented May 31, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests