Snapkit: Swift 3 - CocoaPods Integration Issues

Created on 15 Sep 2016  ·  40Comments  ·  Source: SnapKit/SnapKit

New Issue Checklist

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

wontfix

Most helpful comment

@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

All 40 comments

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

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

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

@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

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.

@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

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: https://github.com/CocoaPods/CocoaPods/issues/5864

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

what time will be support swift3.0?

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

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.

Also, all of those requirements did hold true.

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

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.

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

sudo gem install cocoapods --pre

@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

@sahandnayebaziz Thank you. I'm trying.

@RamboLouis awesome. Ping back if you have any trouble

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

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.

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

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

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

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

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"

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"

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

then:
pod install

now it's ok!

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

@robertjpayne right i just convert to swift 3.0

@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?

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

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

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

@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!

@robertjpayne so sorry...

@robertjpayne delete all pod and pod install again it work

Thank you for attention

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.

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

@PlayLive it worked! thank u!:)

Closing this becauseI believe this is now fixed.

Hey robert fix it for ya? Well I wouldn't made that choice who the hell
are u

On Monday, April 10, 2017, Robert Payne notifications@github.com wrote:

Closing this becauseI believe this is now fixed.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/SnapKit/SnapKit/issues/300#issuecomment-292914089,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJqjoNx_opue9XqlgT4cXjDK0vvwwgd9ks5ruge9gaJpZM4J9XAl
.

--
Sent from Gmail Mobile

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lolgear picture lolgear  ·  5Comments

KaKuiTsang picture KaKuiTsang  ·  10Comments

fcy picture fcy  ·  10Comments

snibble-manan picture snibble-manan  ·  7Comments

arnauddorgans picture arnauddorgans  ·  16Comments