mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 12:45:52 +03:00
[GH-ISSUE #280] XCode8 + Cocoapods 1.1.0.rc.2 + objective-c based #164
Labels
No labels
bug
cocoapod
duplicate
enhancement
feature-request
help wanted
help wanted
invalid
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/OAuthSwift#164
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ikbenben on GitHub (Sep 26, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/280
Hi there,
I'm having trouble building our project after upgrading to XCode8 and Cocoapods 1.1.0.rc.2. Our project is objective-c based and everything was working fine until today. Basically I'm seeing 76 errors in the Pod when it tries to build it.
We are currently importing OAuthSwift using @import OAuthSwift statement. I've tried to switch that to #import "OAuthSwift-swift.h" but there issues are still there. Kind of makes sense as it isn't actually able to build the pod.
A lot of the issues appear to be related to syntax error which leads me to believe it is something to do with Swift 3 or 2.3 updates. I'm not up on Swift yet but an example error is "Expected 'let' in conditional"
Our Podfile.lock file shows that we are using OAuthSwift 0.6.0
Any ideas?
@phimage commented on GitHub (Sep 26, 2016):
please check if you really use 0.6.0 (28 Jul )
and not last commit of master branch (use swift 3 but not yet released)
I will create a swift 2.2 branch now
@ikbenben commented on GitHub (Sep 27, 2016):
Hi @phimage
My Podfile only specifies the pod nae 'OAuthSwift' so I can only assume that it is the commit specified in the pod repository at Cocoapods.
I'm not sure a 2.2 branch helps. XCode 8 expect Swift 2.3 or Swift 3. I saw that there were 2.3 and 3.0 branches in your repository after creating this issue so I was going to update my Podfile to point to one of those and try again. I assume Pods can reference a repo/branch instead of a version
@phimage commented on GitHub (Sep 27, 2016):
yes if you use XCode8 you must choose one branch
you can try swift 2.3 branch
or point to master by specifying the git link (not released yet)
@ikbenben commented on GitHub (Sep 27, 2016):
Hi @phimage that seemed to sort it out. I pointed to the swift 3.0 branch
thanks
@phimage commented on GitHub (Sep 27, 2016):
the swift 3.0 branch is just a "fast" and temporary xcode conversion, master branch have more commit but I don't know its status about compatibility with objective c (due to function renaming)
anyway when OAuthSwift 1.0.0 will be released you will have the last master code branch
@ikbenben commented on GitHub (Oct 9, 2016):
Hi @phimage ,
You seem to have deleted the swift3.0 branch but now I seem to be stuck again. If I point to the swift2.3 branch, the version reverts to 0.6 and I get a lot of compile errors. If I use master, I don't get any compile errors but the authorizeWithCallback:scope:state:params:headers:success:failure: method is not available or any similar method signatures
any ideas how to proceed?
thanks
@phimage commented on GitHub (Oct 9, 2016):
The function has been renamed to follow Swift 3 rules see release note : authorize(withCall...
But I don't know the result using obj c.
Maybe a swift-version file is missing for Swift 2.3 branch. (I think cocoapod use this file to choose Swift version)
@ikbenben commented on GitHub (Oct 9, 2016):
So any suggestions on how I can proceed?
@phimage commented on GitHub (Oct 9, 2016):
I have checked the swift2.3 branch, there is the swift-version file
I create an obc project and add a podfile
maybe try to clean derived data, builds folders
or go to the pod project into your workspace, click OAuthSwift target, then build settings and look for "Use legacy swift language version"
for 2.3 => Yes , for 3.0 => No
@phimage commented on GitHub (Oct 9, 2016):
as information it seems that swift3 branch doesn't expose some functions to objective c
it's a little weird...because there is no "@noobjc" annotation. but maybe I understand why
I create two function with same signature for objective c
maybe if I rename the second one
authorize(withCallbackURLString, this will work...@ikbenben commented on GitHub (Oct 9, 2016):
I think that would solve it. Methods with same signature but different types are not allowed in a lot of languages. I'm surprised it's ok in swift. Can you create a branch and I'll try it tomorrow morning.. It's late here in Amsterdam :)
@phimage commented on GitHub (Oct 9, 2016):
same time here in paris :p
swift3.0objc branch created, you can test it ("Use legacy swift language version" => No in target build settings if many errors)
@ikbenben commented on GitHub (Oct 10, 2016):
Good morning @phimage
I'm still not getting any love. I can see you changed the signature but its still not picking it up. I think the bridging doesn't understand the authorize(withCallbackURL syntax
Any chance we can try an old syntax like authorizeWithCallbackURL. Maybe this is a method that just passes to the authorize(withCallbackURL method?
I've tried to use the 2.3 branch again and get a lot of errors in the library itself. I've taken a screenshot and put it up at https://drive.google.com/file/d/0B1JerioCGxaKRExjN3czN2wzanM/view?usp=sharing
It fails if I try to convert the 2.3 branch
btw, you mention 'Use legacy swift language version' in the build settings but I don't have this setting anywhere
@phimage commented on GitHub (Oct 10, 2016):
If you use cocoapod you have this settings
In workspace created by cocoadpod you must have a "Pods" project (in Finder, under Yourproject/Pods/Pods.xcodeproj)
In this project you must have one target by framework imported, and OAuthSwift must be there
I find why the function is not shown. The failure handler contain typed
OAuthSwiftErrorthat cannot be converted toNSErrorWithout that, swift will ask me to add the @noobjc annotation because of the two functions
authorize(withCallbackURLI add an objc_authorize... function to test
@phimage commented on GitHub (Oct 10, 2016):
I implement
CustomNSErrorprotocol but any changeI see an other issue with the return type
OAuthSwiftRequestHandle(I will add an annotation @objc)I make a new swift3.0objc branch and test that
@ikbenben commented on GitHub (Oct 10, 2016):
k. should I just hold off and wait for your go ahead?
@phimage commented on GitHub (Oct 10, 2016):
So in swift3.0objc I add prefixed function with
bridge_(bridge_authorizeWithCallbackURL)that take a string as URL
You can go with that, but you cannot use "client" functions... In Bridge.swift you must add to fix that all functions : "bridge_get", "bridge_post", etc... (I have no more time)
There is again a problem with "OAuthSwiftHTTPRequest.Method : String" that is not bridged to objc (need NSString maybe but I thinks that's an other swift/objc bridging issue in compilator)
So to resume :
OAuthSwiftErroris not bridged (temporary solution = callback withError). TheOAuthSwiftErrorcould be objective-c compatible if declare a raw type (ex:OAuthSwiftError: Int, Error) but enum with raw type could not have arguments (errors, messages, ...)OAuthSwiftHTTPRequest.Methodis not bridged (put NSString instead of String or create each method "bridge_get", "bridge_post")@ikbenben commented on GitHub (Oct 10, 2016):
I've given it a try and we have LOVE!! :) Thanks for the getting this to work so quickly.
One note, the generate methods didn't include parameter names. I had to manually add the parameter names but no big deal
Not sure if I should close the ticket or if you intend to tidy things up so we can remove the swift3.0obj branch in the future
@phimage commented on GitHub (Oct 10, 2016):
I will try to do better so let's open this issue
I don't want to maintain objc branch
I want to keep compatibility with objc but use swift with its full potential (ie. typed error)
so maybe
@phimage commented on GitHub (Nov 5, 2016):
next version (1.1.0 in master branch), soon released
functions will be prefixed with objc_ instead of bridge
580c85fecc@ikbenben commented on GitHub (Nov 5, 2016):
Thanks @phimage . I'll review and update the project