mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 12:45:52 +03:00
[GH-ISSUE #613] Calling Convenience initialiser when subclassing OAuth2Swift fails from xcode 11.4 onwards #401
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#401
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 @jlynch1 on GitHub (Jul 25, 2020).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/613
Description:
Problem:
Calling convenience initialisers when subclassing
OAuth2Swiftfails from xcode 11.4 onwards. In my case I was using the convenience init with parameteraccessTokenUrlwhich was fine prior to xcode 11.4https://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
OAuth2Swiftis a subclass ofOAuthSwift, the init() ofOAuthSwift, the base class, needs to be made public. That way I can call the convenience initialisers on a subclass ofOAuth2Swiftfrom xcode 11.4 onwards.The version on master works around this by having just a single initialiser (with no convenience initialisers) in
OAuth2SwiftwhereaccessTokenUrlis 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 classOAuth2Swiftexternally from my Application. It is the same as https://github.com/OAuthSwift/OAuthSwiftAlamofire/issues/11 and the workaround is to overriderenewAccessToken()to setclient.credential.oauthToken = ""OAuth Provider? (Twitter, Github, ..): Other
OAuth Version:
OS (Please fill the version) :
Installation method:
Library version:
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 commented on GitHub (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 (https://github.com/OAuthSwift/OAuthSwift/issues/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 https://github.com/OAuthSwift/OAuthSwift/issues/615