[GH-ISSUE #361] error: retain #230

Closed
opened 2026-03-03 16:46:52 +03:00 by kerem · 1 comment
Owner

Originally created by @rcholic on GitHub (Apr 13, 2017).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/361

Description:

OAuth Provider (Twitter, Github, ..):

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

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

Installation method:

  • Carthage
  • CocoaPods
  • Manually

Library version:

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

Xcode version:

  • 8.0 (Swift 3.0)

  • 8.0 (Swift 2.3)

  • 7.3.1

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

  • objective c

I'm trying to use OAuthSwift for accessing Twitter, and I have this below login() method in my view controller, but I see error: retain in the console when I ran iPhone simulator.

private func login() {
        let oauthswift = OAuth1Swift(
            consumerKey:    TWT_CONSUMER_KEY,
            consumerSecret: TWT_CONSUMER_SECRET,
            requestTokenUrl: "https://api.twitter.com/oauth/request_token",
            authorizeUrl:    "https://api.twitter.com/oauth/authorize",
            accessTokenUrl:  "https://api.twitter.com/oauth/access_token"
        )
        
        let handle = oauthswift.authorize(
            withCallbackURL: URL(string: TWITTER_CALLBACK_URL)!,
            success: { credential, response, parameters in
                print("success: \(credential.oauthToken)")
            },
                failure: { error in
                    print("error: \(error.description)")
            }
        )
        
    }

What could be wrong with my code? I copied it from the example basically. Thanks

Originally created by @rcholic on GitHub (Apr 13, 2017). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/361 ### Description: ### OAuth Provider (Twitter, Github, ..): ### OAuth Version: - [x] Version 1 - [ ] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [x] CocoaPods - [ ] Manually ### Library version: - [ ] head - [x] v1.0.0 - [ ] v0.6 - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [x] 8.0 (Swift 3.0) - [ ] 8.0 (Swift 2.3) - [ ] 7.3.1 - [ ] other: (Please fill in the version you are using.) - [ ] objective c I'm trying to use `OAuthSwift` for accessing Twitter, and I have this below **login()** method in my view controller, but I see `error: retain` in the console when I ran iPhone simulator. ``` private func login() { let oauthswift = OAuth1Swift( consumerKey: TWT_CONSUMER_KEY, consumerSecret: TWT_CONSUMER_SECRET, requestTokenUrl: "https://api.twitter.com/oauth/request_token", authorizeUrl: "https://api.twitter.com/oauth/authorize", accessTokenUrl: "https://api.twitter.com/oauth/access_token" ) let handle = oauthswift.authorize( withCallbackURL: URL(string: TWITTER_CALLBACK_URL)!, success: { credential, response, parameters in print("success: \(credential.oauthToken)") }, failure: { error in print("error: \(error.description)") } ) } ``` What could be wrong with my code? I copied it from the example basically. Thanks
kerem closed this issue 2026-03-03 16:46:52 +03:00
Author
Owner

@rcholic commented on GitHub (Apr 13, 2017):

sorry, I got it. Just needed to put the variable as a property to the view controller like this:

var oauthswift: OAuth1Swift?

Thanks!

<!-- gh-comment-id:294021702 --> @rcholic commented on GitHub (Apr 13, 2017): sorry, I got it. Just needed to put the variable as a property to the view controller like this: ``` var oauthswift: OAuth1Swift? ``` Thanks!
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#230
No description provided.