[GH-ISSUE #341] SFSafariViewController dismisses two times after pressing Done #213

Closed
opened 2026-03-03 16:46:43 +03:00 by kerem · 2 comments
Owner

Originally created by @yjb94 on GitHub (Feb 27, 2017).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/341

Description:

let handler = SafariURLHandler(viewController: vc, oauthSwift: instaOAuth)
handler.factory = { url in
     return SocialSafariViewController(url: url)
}

SocialSafariViewController has no other special function dismissing.

here is my logic

i open twitter to auth(with SFSafari) -> i press done(without authentication) -> i open twitter again -> i login to twitter account and finish authorize -> redirects to my app -> the SafariURLHandler dismisses my modal view as well(it occurs dismiss two times)

need fix

OAuth Provider (Twitter, Github, ..):

twitter / instagram

OAuth Version:

  • [o] Version 1
  • [o] Version 2

OS (Please fill the version) :

  • [o] iOS : 10.0.2
  • OSX :
  • TVOS :
  • WatchOS :

Installation method:

  • Carthage
  • [o] CocoaPods
  • Manually

Library version:

  • [o ] head
  • v1.0.0
  • v0.6
  • other: (Please fill in the version you are using.)

Xcode version:

  • [o] 8.0 (Swift 3.0)

  • 8.0 (Swift 2.3)

  • 7.3.1

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

  • objective c

Originally created by @yjb94 on GitHub (Feb 27, 2017). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/341 ### Description: ``` let handler = SafariURLHandler(viewController: vc, oauthSwift: instaOAuth) handler.factory = { url in return SocialSafariViewController(url: url) } ``` SocialSafariViewController has no other special function dismissing. here is my logic i open twitter to auth(with SFSafari) -> i press done(without authentication) -> i open twitter again -> i login to twitter account and finish authorize -> redirects to my app -> the SafariURLHandler dismisses my modal view as well(it occurs dismiss two times) need fix ### OAuth Provider (Twitter, Github, ..): twitter / instagram ### OAuth Version: - [o] Version 1 - [o] Version 2 ### OS (Please fill the version) : - [o] iOS : 10.0.2 - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [o] CocoaPods - [ ] Manually ### Library version: - [o ] head - [ ] v1.0.0 - [ ] v0.6 - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [o] 8.0 (Swift 3.0) - [ ] 8.0 (Swift 2.3) - [ ] 7.3.1 - [ ] other: (Please fill in the version you are using.) - [ ] objective c
kerem closed this issue 2026-03-03 16:46:43 +03:00
Author
Owner

@phimage commented on GitHub (Feb 27, 2017):

You can call on your SafariURLHandler the function clearObservers
(there is also cancel method on OAuthSwift object)

Must be call automatically by safariViewControllerDidFinish in OAuthSwiftURLHandlerType, but if there is some issue, you can put a break point
Pressing "Done" close the window without passing here?

<!-- gh-comment-id:282650372 --> @phimage commented on GitHub (Feb 27, 2017): You can call on your `SafariURLHandler` the function `clearObservers` (there is also `cancel` method on `OAuthSwift` object) Must be call automatically by `safariViewControllerDidFinish` in [OAuthSwiftURLHandlerType](https://github.com/OAuthSwift/OAuthSwift/blob/master/Sources/OAuthSwiftURLHandlerType.swift), but if there is some issue, you can put a break point Pressing "Done" close the window without passing here?
Author
Owner

@phimage commented on GitHub (Jun 4, 2017):

I cannot reproduce it in demo app
I press Done for twitter first time
Then I retry twitter auth, and enter my user credential, authorize the app
I have only one dismiss
In demo a SafariURLHandler is created each time we try to connect

then SocialSafariViewController is unknown for me, you override SFSafariViewController ?

I close. I will reopen if more information

<!-- gh-comment-id:306030444 --> @phimage commented on GitHub (Jun 4, 2017): I cannot reproduce it in demo app I press Done for twitter first time Then I retry twitter auth, and enter my user credential, authorize the app I have only one dismiss In demo a `SafariURLHandler` is created each time we try to connect then `SocialSafariViewController` is unknown for me, you override `SFSafariViewController` ? I close. I will reopen if more information
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#213
No description provided.