[GH-ISSUE #580] Dismissing bug with SFsafari #378

Closed
opened 2026-03-03 16:48:11 +03:00 by kerem · 3 comments
Owner

Originally created by @aakarshsasi on GitHub (Mar 27, 2020).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/580

Description:

I am presenting a view controller modally and when a button is pressed on that SFSafariViewController is used to authenticate the user. I am calling the handle.dissmisscompletion to know if the dismiss is completed. The dismiss completion is excecuted correctly. But the problem is it does not dismiss the handler(Safari), but it dismisses the view controller I am using to present the signup button.
This is happening only when modalPresentationStyle = . overCurrentContext

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

OAuth Version:

  • [x ] Version 1
  • Version 2

OS (Please fill the version) :

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

Installation method:

  • Carthage
  • [x ] CocoaPods
  • Swift Package Manager
  • Manually

Library version:

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

Xcode version:

  • [x ] 11.x (Swift 5.1)

  • 10.x (Swift 5.0)

  • 10.x (Swift 4.1)

  • 9.3 (Swift 4.1)

  • 9.0 (Swift 4.0)

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

  • objective c

Originally created by @aakarshsasi on GitHub (Mar 27, 2020). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/580 ### Description: I am presenting a view controller modally and when a button is pressed on that SFSafariViewController is used to authenticate the user. I am calling the handle.dissmisscompletion to know if the dismiss is completed. The dismiss completion is excecuted correctly. But the problem is it does not dismiss the handler(Safari), but it dismisses the view controller I am using to present the signup button. This is happening only when modalPresentationStyle = . overCurrentContext ### OAuth Provider? (Twitter, Github, ..): Twitter ### OAuth Version: - [x ] Version 1 - [ ] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [x ] CocoaPods - [ ] Swift Package Manager - [ ] Manually ### Library version: - [ ] head - [ ] v2.1.0 - [x] v2.0.0 - [ ] v1.4.1 - [ ] v1.2 (Swift 4.0) - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [x ] 11.x (Swift 5.1) - [ ] 10.x (Swift 5.0) - [ ] 10.x (Swift 4.1) - [ ] 9.3 (Swift 4.1) - [ ] 9.0 (Swift 4.0) - [ ] other: (Please fill in the version you are using.) - [ ] objective c
kerem closed this issue 2026-03-03 16:48:12 +03:00
Author
Owner

@nonegu commented on GitHub (Mar 27, 2020):

Following might be the problem here.

If you present several view controllers in succession, thus building a stack of presented view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack. The top-most view is dismissed using its modal transition style, which may differ from the styles used by other view controllers lower in the stack.

Please refer to the documentation if this is the case.
https://developer.apple.com/documentation/uikit/uiviewcontroller/1621505-dismiss

<!-- gh-comment-id:605341291 --> @nonegu commented on GitHub (Mar 27, 2020): Following might be the problem here. > If you present several view controllers in succession, thus building a stack of presented view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack. The top-most view is dismissed using its modal transition style, which may differ from the styles used by other view controllers lower in the stack. Please refer to the documentation if this is the case. https://developer.apple.com/documentation/uikit/uiviewcontroller/1621505-dismiss
Author
Owner

@aakarshsasi commented on GitHub (Mar 28, 2020):

There is only one view controller present in the stack, on top of which the safari view controller is presented. It is happening only when using modalpresentationstyle as .overCurrentContext and not when using .currentContext or .fullScreen

<!-- gh-comment-id:605407345 --> @aakarshsasi commented on GitHub (Mar 28, 2020): There is only one view controller present in the stack, on top of which the safari view controller is presented. It is happening only when using modalpresentationstyle as .overCurrentContext and not when using .currentContext or .fullScreen
Author
Owner

@phimage commented on GitHub (Jul 11, 2020):

in this situation you must debug to provide more information... or provide ready demo app with the issue

when you build your safari controller you pass a controller
this controller is used to present and dismiss the safari controller, not complicated to see it
github.com/OAuthSwift/OAuthSwift@8c931c76de/Sources/Handler/SafariURLHandler.swift (L44)
You can customise the UITransition, make your own, etc.. there is a constructor with that

Then the dismiss is here
github.com/OAuthSwift/OAuthSwift@8c931c76de/Sources/Handler/SafariURLHandler.swift (L92)

<!-- gh-comment-id:657015697 --> @phimage commented on GitHub (Jul 11, 2020): in this situation you must debug to provide more information... or provide ready demo app with the issue when you build your safari controller you pass a controller this controller is used to present and dismiss the safari controller, not complicated to see it https://github.com/OAuthSwift/OAuthSwift/blob/8c931c76de8b31d192bff12fe98caf7f626f6426/Sources/Handler/SafariURLHandler.swift#L44 You can customise the `UITransition`, make your own, etc.. there is a constructor with that Then the dismiss is here https://github.com/OAuthSwift/OAuthSwift/blob/8c931c76de8b31d192bff12fe98caf7f626f6426/Sources/Handler/SafariURLHandler.swift#L92
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#378
No description provided.