Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created September 2, 2018 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/1c41dfc68fc69f28d4dd204687de8b32 to your computer and use it in GitHub Desktop.
Save fitomad/1c41dfc68fc69f28d4dd204687de8b32 to your computer and use it in GitHub Desktop.
TraktTVClient.shared.appendToWatchlist(show, handler: { (validOperation: Bool, error: TraktError?) -> Void in
if validOperation
{
...
}
else if let error = error
{
if case .unauthorized = error
{
// No estamos autorizados a acceder a los datos del usuarios
// Vamos a pedirle que nos autorize
if let oauthURL = TraktTVClient.shared.authorizationURL()
{
let safariController = SFSafariViewController(url: oauthURL)
DispatchQueue.main.async
{
self.present(safariController, animated:true, completion:nil)
}
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment