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

Calling Convenience initialiser when subclassing OAuth2Swift fails from xcode 11.4 onwards #613

Closed
6 of 20 tasks
jlynch1 opened this issue Jul 25, 2020 · 1 comment
Closed
6 of 20 tasks
Milestone

Comments

@jlynch1
Copy link

jlynch1 commented Jul 25, 2020

Description:

Problem:
Calling convenience initialisers when subclassing OAuth2Swift fails from xcode 11.4 onwards. In my case I was using the convenience init with parameter accessTokenUrl which was fine prior to xcode 11.4

https://developer.apple.com/documentation/xcode_release_notes/xcode_11_4_release_notes
Convenience initializer inheritance for subclasses defined outside the module that defines the base class now comes with additional restrictions. When these subclasses have a base class with non-public designated initializers, they no longer automatically inherit convenience initializers from their superclasses. To restore this automatic inheritance behavior, the base class must ensure that all of its designated initializers are public or open. (51249311)

Fix/Workaround for 2.0 and 2.1 branch
As OAuth2Swift is a subclass of OAuthSwift, the init() of OAuthSwift , the base class, needs to be made public. That way I can call the convenience initialisers on a subclass of OAuth2Swift from xcode 11.4 onwards.

The version on master works around this by having just a single initialiser (with no convenience initialisers) in OAuth2Swift where accessTokenUrl is an optional default parameter with default value of nil.

Aside:
Reason why I need to subclass is due to an issue when calling the method renewAccessToken() of class OAuth2Swift externally from my Application. It is the same as OAuthSwift/OAuthSwiftAlamofire#11 and the workaround is to override renewAccessToken() to set client.credential.oauthToken = ""

OAuth Provider? (Twitter, Github, ..): Other

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

  • iOS :
  • OSX :
  • TVOS :
  • WatchOS :

Installation method:

  • Carthage
  • CocoaPods
  • Swift Package Manager
  • Manually

Library version:

  • head
  • v2.1.0
  • v2.0.0
  • v1.4.1
  • other: (Please fill in the version you are using.)

Xcode version:

  • 11.4 (Swift 5.2)

  • 11.x (Swift 5.1)

  • 10.x (Swift 5.0)

  • other: (Please fill in the version you are using.)

  • objective c

jlynch1 pushed a commit to jlynch1/OAuthSwift that referenced this issue Jul 27, 2020
jlynch1 pushed a commit to jlynch1/OAuthSwift that referenced this issue Jul 27, 2020
@jlynch1
Copy link
Author

jlynch1 commented Aug 19, 2020

switching to use swiftpm I can now get 2.1.2 tag which is on the master branch which solves the Convenience initialiser issue (#585). It looks like the 2.1 branch is not used for development anymore.

For CocoaPods we were stuck on earlier version 2.1.0 due to the OAuthSwift.podspec not been updated as was mentioned in #615

phimage added a commit that referenced this issue Nov 10, 2020
#613 Calling Convenience initialiser when subclassing OAuth2Swift fai…
@phimage phimage closed this as completed Apr 29, 2021
@phatblat phatblat added this to the 2.1.3 milestone May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants