auth0 / Auth0.swift

Auth0 SDK for Apple platforms
https://auth0.github.io/Auth0.swift
MIT License
351 stars 230 forks source link

1.9 not compiling in Xcode9 #166

Closed helloniklas closed 7 years ago

helloniklas commented 7 years ago

So as usual when there is a new release things stop working.

Done a pod update to 1.9

It now complains about

Header 'Auth0-Swift.h' not found

Cannot convert value of type '(_) -> ()' to expected argument type 'SFAuthenticationSession.CompletionHandler' (aka '(Optional, Optional) -> ()')

in SafariAuthenticationSessionCallback.

Any ideas?

cocojoe commented 7 years ago

So I can guess what this is, you are using Cocoapods in a Swift 4 project, when dependencies are added Cocoapods will set the dependency projects Swift version to 4.0 regardless of their actual swift version (Cocoapods bug).

In this case the Auth0.swift lib is Swift 3.2 for compatibility in both Xcode 8 and 9. So the error is thrown on the above is due to the lib being changed from 3.2 to 4.0. The 'Auth0-swift.h' header is missing because it couldn't compile.

There is an easy fix for this if you take a look at https://github.com/auth0/Lock.swift/issues/470

helloniklas commented 7 years ago

Yes I'm on Swift4. Thanks will follow that post.

helloniklas commented 7 years ago

Still gives the error

Cannot convert value of type '(_) -> ()' to expected argument type 'SFAuthenticationSession.CompletionHandler' (aka '(Optional<URL>, Optional<Error>) -> ()')

Will revert to 1.8.0 until this is fixed.

cocojoe commented 7 years ago

I imagine you probably have to deintegrate the pod and reinstall for an existing project vs a new one. So I just quickly checked this, you can also update setting in the existing Xcode project. Set to Swift 3.2

screen shot 2017-10-20 at 13 04 11
helloniklas commented 7 years ago

Ok thanks. That now works

cocojoe commented 7 years ago

Well I can recreate your error easily and also easily fix with correcting the swift version. Only other thing I can suggest for you to is clean the project and possibly clear out your derived data and rebuild.

I will also look at a fix in Swift 4

helloniklas commented 7 years ago

@cocojoe sorry, it did work in the end... it somehow switched back to 4.0... but it now works when set to 3.2. Thanks for swift reply...