[GH-ISSUE #519] Retain Error #342

Closed
opened 2026-03-03 16:47:51 +03:00 by kerem · 23 comments
Owner

Originally created by @sandeepk000 on GitHub (Mar 5, 2019).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/519

switch error {

        case OAuthSwiftError.tokenExpired:
            _ = self.renewAccessToken(withRefreshToken: self.client.credential.oauthRefreshToken, headers: renewHeaders ?? headers, success: { (credential, _, _) in
                // Ommit response parameters so they don't override the original ones
                // We have successfully renewed the access token.

                // If provided, fire the onRenewal closure
                if let renewalCallBack = onTokenRenewal {
                    renewalCallBack(credential)
                }

in this function when error is tokenExpired it goes into renewAccessToken function but self.client.credential.oauthRefreshToken = "".Please Help

Originally created by @sandeepk000 on GitHub (Mar 5, 2019). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/519 switch error { case OAuthSwiftError.tokenExpired: _ = self.renewAccessToken(withRefreshToken: self.client.credential.oauthRefreshToken, headers: renewHeaders ?? headers, success: { (credential, _, _) in // Ommit response parameters so they don't override the original ones // We have successfully renewed the access token. // If provided, fire the onRenewal closure if let renewalCallBack = onTokenRenewal { renewalCallBack(credential) } in this function when error is tokenExpired it goes into renewAccessToken function but self.client.credential.oauthRefreshToken = "".Please Help
kerem closed this issue 2026-03-03 16:47:52 +03:00
Author
Owner

@phimage commented on GitHub (Mar 5, 2019):

if you can debug the connection this can help

a breakpoint here
github.com/OAuthSwift/OAuthSwift@1ba85d0837/Sources/OAuth2Swift.swift (L227)

if let refreshToken = responseParameters["refresh_token"] as? String {
                this.client.credential.oauthRefreshToken = refreshToken.safeStringByRemovingPercentEncoding
            }

to see if there is in responseParameters the "refresh_token" or not, or maybe named

You remove all issue template with many questions I ask, next time I close the issue without helping
Because I need to know the oauth provider for instance

<!-- gh-comment-id:469726996 --> @phimage commented on GitHub (Mar 5, 2019): if you can debug the connection this can help a breakpoint here https://github.com/OAuthSwift/OAuthSwift/blob/1ba85d0837fa052ea556acd925a7c4ae8beec42a/Sources/OAuth2Swift.swift#L227 ```swift if let refreshToken = responseParameters["refresh_token"] as? String { this.client.credential.oauthRefreshToken = refreshToken.safeStringByRemovingPercentEncoding } ```` to see if there is in `responseParameters` the "refresh_token" or not, or maybe named You remove all issue template with many questions I ask, next time I close the issue without helping Because I need to know the oauth provider for instance
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

fileprivate func requestOAuthAccessToken(withParameters parameters: OAuthSwift.Parameters, headers: OAuthSwift.Headers? = nil, success: @escaping TokenSuccessHandler, failure: FailureHandler?) -> OAuthSwiftRequestHandle? {
    let successHandler: OAuthSwiftHTTPRequest.SuccessHandler = { [weak self] response in
        guard let this = self else {
            OAuthSwift.retainError(failure)
            return
        }

here self is nil every time it goes into else only i added refresh token.please help

<!-- gh-comment-id:469728392 --> @sandeepk000 commented on GitHub (Mar 5, 2019): fileprivate func requestOAuthAccessToken(withParameters parameters: OAuthSwift.Parameters, headers: OAuthSwift.Headers? = nil, success: @escaping TokenSuccessHandler, failure: FailureHandler?) -> OAuthSwiftRequestHandle? { let successHandler: OAuthSwiftHTTPRequest.SuccessHandler = { [weak self] response in guard let this = self else { OAuthSwift.retainError(failure) return } here self is nil every time it goes into else only i added refresh token.please help
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

if you can debug the connection this can help

a breakpoint here
OAuthSwift/Sources/OAuth2Swift.swift

Line 227 in 1ba85d0

if let refreshToken = responseParameters["refresh_token"] as? String {

if let refreshToken = responseParameters["refresh_token"] as? String {
                this.client.credential.oauthRefreshToken = refreshToken.safeStringByRemovingPercentEncoding
            }

to see if there is in responseParameters the "refresh_token" or not, or maybe named

You remove all issue template with many questions I ask, next time I close the issue without helping
Because I need to know the oauth provider for instance

i kept a break point here its not executing this part of code.my config
var oauthswift = OAuth2Swift(
consumerKey: StringConstant.oauth_client_id, // [1] Enter google app settings
consumerSecret: KeychainService.shared[KEY_GOOGLE.KEY_NAME_OAUTH_CLIENT_SECRET]!, // No secret required
authorizeUrl: RequestURL.URL_OAUTH_ACCESS_TOKEN.rawValue,
accessTokenUrl: RequestURL.URL_OAUTH_ACCESS_TOKEN.rawValue,
responseType: StringConstant.token
)

<!-- gh-comment-id:469728767 --> @sandeepk000 commented on GitHub (Mar 5, 2019): > if you can debug the connection this can help > > a breakpoint here > [OAuthSwift/Sources/OAuth2Swift.swift](https://github.com/OAuthSwift/OAuthSwift/blob/1ba85d0837fa052ea556acd925a7c4ae8beec42a/Sources/OAuth2Swift.swift#L227) > > Line 227 in [1ba85d0](/OAuthSwift/OAuthSwift/commit/1ba85d0837fa052ea556acd925a7c4ae8beec42a) > > if let refreshToken = responseParameters["refresh_token"] as? String { > ```swift > if let refreshToken = responseParameters["refresh_token"] as? String { > this.client.credential.oauthRefreshToken = refreshToken.safeStringByRemovingPercentEncoding > } > ``` > > to see if there is in `responseParameters` the "refresh_token" or not, or maybe named > > You remove all issue template with many questions I ask, next time I close the issue without helping > Because I need to know the oauth provider for instance i kept a break point here its not executing this part of code.my config var oauthswift = OAuth2Swift( consumerKey: StringConstant.oauth_client_id, // [1] Enter google app settings consumerSecret: KeychainService.shared[KEY_GOOGLE.KEY_NAME_OAUTH_CLIENT_SECRET]!, // No secret required authorizeUrl: RequestURL.URL_OAUTH_ACCESS_TOKEN.rawValue, accessTokenUrl: RequestURL.URL_OAUTH_ACCESS_TOKEN.rawValue, responseType: StringConstant.token )
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

not executing the line 227 because of this retainerror self is nil.please help.\

fileprivate func requestOAuthAccessToken(withParameters parameters: OAuthSwift.Parameters, headers: OAuthSwift.Headers? = nil, success: @escaping TokenSuccessHandler, failure: FailureHandler?) -> OAuthSwiftRequestHandle? {
let successHandler: OAuthSwiftHTTPRequest.SuccessHandler = { [weak self] response in
guard let this = self else {
OAuthSwift.retainError(failure)
return
}

<!-- gh-comment-id:469730855 --> @sandeepk000 commented on GitHub (Mar 5, 2019): not executing the line 227 because of this retainerror self is nil.please help.\ fileprivate func requestOAuthAccessToken(withParameters parameters: OAuthSwift.Parameters, headers: OAuthSwift.Headers? = nil, success: @escaping TokenSuccessHandler, failure: FailureHandler?) -> OAuthSwiftRequestHandle? { let successHandler: OAuthSwiftHTTPRequest.SuccessHandler = { [weak self] response in guard let this = self else { OAuthSwift.retainError(failure) return }
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

please explain how can i retain and close this issue

<!-- gh-comment-id:469731739 --> @sandeepk000 commented on GitHub (Mar 5, 2019): please explain how can i retain and close this issue
Author
Owner

@phimage commented on GitHub (Mar 5, 2019):

you call authorize to login
then the url handler (browser etc.. open an url and you log)

the callback is called after that
github.com/OAuthSwift/OAuthSwift@1ba85d0837/Sources/OAuth2Swift.swift (L89)

did you receive access token directly?
github.com/OAuthSwift/OAuthSwift@1ba85d0837/Sources/OAuth2Swift.swift (L101)
I think some is missing here

if not post function is called
github.com/OAuthSwift/OAuthSwift@1ba85d0837/Sources/OAuth2Swift.swift (L123)
which call the method I ask to add debug point
github.com/OAuthSwift/OAuthSwift@1ba85d0837/Sources/OAuth2Swift.swift (L205)

<!-- gh-comment-id:469732039 --> @phimage commented on GitHub (Mar 5, 2019): you call `authorize` to login then the url handler (browser etc.. open an url and you log) the callback is called after that https://github.com/OAuthSwift/OAuthSwift/blob/1ba85d0837fa052ea556acd925a7c4ae8beec42a/Sources/OAuth2Swift.swift#L89 did you receive access token directly? https://github.com/OAuthSwift/OAuthSwift/blob/1ba85d0837fa052ea556acd925a7c4ae8beec42a/Sources/OAuth2Swift.swift#L101 I think some is missing here if not post function is called https://github.com/OAuthSwift/OAuthSwift/blob/1ba85d0837fa052ea556acd925a7c4ae8beec42a/Sources/OAuth2Swift.swift#L123 which call the method I ask to add debug point https://github.com/OAuthSwift/OAuthSwift/blob/1ba85d0837fa052ea556acd925a7c4ae8beec42a/Sources/OAuth2Swift.swift#L205
Author
Owner

@phimage commented on GitHub (Mar 5, 2019):

yo retain do not do
var oauthswift = ... or let oauthswift = ...

but create a var oauthswift: OAuthSwift? in your controller

and do
self.oauthswift = OAuth....

<!-- gh-comment-id:469732764 --> @phimage commented on GitHub (Mar 5, 2019): yo retain do not do var oauthswift = ... or let oauthswift = ... but create a var oauthswift: OAuthSwift? in your controller and do self.oauthswift = OAuth....
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

sir, i dont want to login with browser

so i didnt use authorize method

Instead i used startAuthorizedRequest and passed token url parameters

so in this case oauthRefreshToken is not getting assigned in your library

<!-- gh-comment-id:469733981 --> @sandeepk000 commented on GitHub (Mar 5, 2019): sir, i dont want to login with browser so i didnt use authorize method Instead i used startAuthorizedRequest and passed token url parameters so in this case oauthRefreshToken is not getting assigned in your library
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

i got refresh token now but not able to solve this retain error

fileprivate func requestOAuthAccessToken(withParameters parameters: OAuthSwift.Parameters, headers: OAuthSwift.Headers? = nil, success: @escaping TokenSuccessHandler, failure: FailureHandler?) -> OAuthSwiftRequestHandle? {
let successHandler: OAuthSwiftHTTPRequest.SuccessHandler = { [weak self] response in
guard let this = self else {
OAuthSwift.retainError(failure)
return
}

every time this self is becoming nil.please help with this

<!-- gh-comment-id:469736438 --> @sandeepk000 commented on GitHub (Mar 5, 2019): i got refresh token now but not able to solve this retain error fileprivate func requestOAuthAccessToken(withParameters parameters: OAuthSwift.Parameters, headers: OAuthSwift.Headers? = nil, success: @escaping TokenSuccessHandler, failure: FailureHandler?) -> OAuthSwiftRequestHandle? { let successHandler: OAuthSwiftHTTPRequest.SuccessHandler = { [weak self] response in guard let this = self else { OAuthSwift.retainError(failure) return } every time this self is becoming nil.please help with this
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

yo retain do not do
var oauthswift = ... or let oauthswift = ...

but create a var oauthswift: OAuthSwift? in your controller

and do
self.oauthswift = OAuth....

tried this not working do you want me to add weak or anything while declaring?

<!-- gh-comment-id:469737067 --> @sandeepk000 commented on GitHub (Mar 5, 2019): > yo retain do not do > var oauthswift = ... or let oauthswift = ... > > but create a var oauthswift: OAuthSwift? in your controller > > and do > self.oauthswift = OAuth.... tried this not working do you want me to add weak or anything while declaring?
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

i think problem is i am calling oauthswift from class not view controller.

class CloudManager {

var oauthswift: OAuth2Swift?

so it is not able to retain do u think so?

<!-- gh-comment-id:469747647 --> @sandeepk000 commented on GitHub (Mar 5, 2019): i think problem is i am calling oauthswift from class not view controller. class CloudManager { var oauthswift: OAuth2Swift? so it is not able to retain do u think so?
Author
Owner

@phimage commented on GitHub (Mar 5, 2019):

yes you can keep in your manager class, it is better!
if your cloud manager is not released in memory (there is an instance somewhere, singleton or controller or app delelegate or anywhere)

<!-- gh-comment-id:469750498 --> @phimage commented on GitHub (Mar 5, 2019): yes you can keep in your manager class, it is better! if your cloud manager is not released in memory (there is an instance somewhere, singleton or controller or app delelegate or anywhere)
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

i kept in cloud manager class retain error is still coming please help.should i share screen

i intialized refresh token using this self.oauthswift!.client.credential.oauthRefreshToken = MyDefaults.getData(key: DefaultKeys.KEY_REFRESH_TOKEN) as! String

<!-- gh-comment-id:469753162 --> @sandeepk000 commented on GitHub (Mar 5, 2019): i kept in cloud manager class retain error is still coming please help.should i share screen i intialized refresh token using this self.oauthswift!.client.credential.oauthRefreshToken = MyDefaults.getData(key: DefaultKeys.KEY_REFRESH_TOKEN) as! String
Author
Owner

@phimage commented on GitHub (Mar 5, 2019):

little tip: avoid using ! (see force_cast in swiftlint)

I cannot help without the code and do want to do share screen

your cloud manager is retained by what?
where did you create it and where did you affect it
did you make for instance a singleton and use CloudManager.instance.auth() like that

class CloudManager {
 static let instance = CloudManager()

 func auth() {
  self.oauthswift = OAth()...

  oauth.authorize()
}

}
<!-- gh-comment-id:469755860 --> @phimage commented on GitHub (Mar 5, 2019): little tip: avoid using `!` (see force_cast in swiftlint) I cannot help without the code and do want to do share screen your cloud manager is retained by what? where did you create it and where did you affect it did you make for instance a singleton and use CloudManager.instance.auth() like that ```swift class CloudManager { static let instance = CloudManager() func auth() { self.oauthswift = OAth()... oauth.authorize() } } ```
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

make

i can share screen

<!-- gh-comment-id:469756158 --> @sandeepk000 commented on GitHub (Mar 5, 2019): > make i can share screen
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

little tip: avoid using ! (see force_cast in swiftlint)

I cannot help without the code and do want to do share screen

your cloud manager is retained by what?
where did you create it and where did you affect it
did you make for instance a singleton and use CloudManager.instance.auth() like that

class CloudManager {
 static let instance = CloudManager()

 func auth() {
  self.oauthswift = OAth()...

  oauth.authorize()
}

}
<!-- gh-comment-id:469756242 --> @sandeepk000 commented on GitHub (Mar 5, 2019): > little tip: avoid using `!` (see force_cast in swiftlint) > > I cannot help without the code and do want to do share screen > > your cloud manager is retained by what? > where did you create it and where did you affect it > did you make for instance a singleton and use CloudManager.instance.auth() like that > > ```swift > class CloudManager { > static let instance = CloudManager() > > func auth() { > self.oauthswift = OAth()... > > oauth.authorize() > } > > } > ```
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

screen shot 2019-03-05 at 10 14 41 pm
screen shot 2019-03-05 at 10 15 07 pm
see these two screeen shots self is becoming nil

<!-- gh-comment-id:469756859 --> @sandeepk000 commented on GitHub (Mar 5, 2019): ![screen shot 2019-03-05 at 10 14 41 pm](https://user-images.githubusercontent.com/46209817/53821764-6b55b700-3f94-11e9-9512-a3ea7d2b7966.png) ![screen shot 2019-03-05 at 10 15 07 pm](https://user-images.githubusercontent.com/46209817/53821777-70b30180-3f94-11e9-9c85-4364d4a37385.png) see these two screeen shots self is becoming nil
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

My Cloud MAnager class is like this

import OAuthSwift
import ObjectMapper

class CloudManager {

let errorResponse:DataResponse<Any>? = nil
let stringErrorResponse: DataResponse<String>? = nil

var accessToken: String?
var oauthswift: OAuth2Swift?
func makeCloudRequest(url:String,parameter:[String:Any],headers:[String:String],requestType:HTTPMethod ,completionHandler: @escaping (DataResponse<Any>?) -> Void ){
    var method:OAuthSwiftHTTPRequest.Method?
    var parameters:[String:Any] = parameter
    if requestType == .post{
        method = .POST
    }else if requestType == .get{
        method = .GET
        parameters = [:]
    }else if requestType == .put{
        method = .PUT
    }
    self.oauthswift = OAuth2Swift(
        consumerKey: StringConstant.oauth_client_id,         // [1] Enter google app settings
        consumerSecret: KeychainService.shared[KEY_GOOGLE.KEY_NAME_OAUTH_CLIENT_SECRET]!,        // No secret required
        authorizeUrl: RequestURL.URL_OAUTH_ACCESS_TOKEN.rawValue,
        accessTokenUrl: RequestURL.URL_OAUTH_ACCESS_TOKEN.rawValue,
        responseType: StringConstant.token
    )
    if NetworkCheck.isNetwork() {
        let queue = DispatchQueue(label: "com.test.api", qos: .background, attributes: .concurrent)
        queue.async {
            self.oauthswift!.client.credential.oauthRefreshToken = MyDefaults.getData(key: DefaultKeys.KEY_REFRESH_TOKEN) as! String
            self.oauthswift!.startAuthorizedRequest(url, method: method!, parameters: parameters,headers:headers,onTokenRenewal: { (credential) in
                    print(credential)
                    MyDefaults.setData(value: credential.oauthToken, key: DefaultKeys.KEY_TOKEN)
                    MyDefaults.setData(value:credential.oauthRefreshToken,key:DefaultKeys.KEY_REFRESH_TOKEN)
                }, success: { (response) in
                    try? completionHandler(DataResponse(request: response.request, response: response.response, data: response.data, result: .success(try response.jsonObject())))
                    if url == RequestURL.URL_OAUTH_ACCESS_TOKEN.rawValue{

// if let responseParameters = try? response.jsonObject() as! [String:Any]{
// if let expiresIn = responseParameters["expires_in"] as? String, let offset = Double(expiresIn) {
// self.oauthswift.client.credential.oauthTokenExpiresAt = Date(timeInterval: offset, since: Date())
// } else if let expiresIn = responseParameters["expires_in"] as? Double {
// self.oauthswift.client.credential.oauthTokenExpiresAt = Date(timeInterval: expiresIn, since: Date())
// }
// }

                        self.oauthswift!.renewAccessToken(withRefreshToken: MyDefaults.getData(key: DefaultKeys.KEY_REFRESH_TOKEN) as! String,
                            success: { (OAuthSwiftCredential, OAuthSwiftResponse, OAuthSwiftParameters) in
                            MyDefaults.setData(value: OAuthSwiftCredential.oauthToken, key: DefaultKeys.KEY_TOKEN)
                        },
                            failure: { (OAuthSwiftError) in

                        })
                    }
                }, failure: { (OAuthSwiftError) in
                    do{
                        let error = (OAuthSwiftError.errorUserInfo["error"] as! NSError).userInfo as! [String:Any]
                        if let data = error[StringConstant.responseDataKey]{
                            let response = try JSONSerialization.jsonObject(with: data  as! Data, options: [])
                            completionHandler(DataResponse(request: OAuthSwiftError.errorUserInfo[StringConstant.request] as? URLRequest, response: error[StringConstant.responseKey] as? HTTPURLResponse, data: data as? Data, result: .success(response)))
                        }else{
                            completionHandler(self.errorResponse)
                        }
                    } catch let error as NSError {
                        print(error)
                    }
                })
        }
    }else{
        
        if let view = Constants.appDelegate?.window?.rootView(){
            ToastPopUp.showNetworkPOPup(message:ToastMsgConstant.network ,view: view)
        }
        completionHandler(errorResponse)
    }
}
<!-- gh-comment-id:469757890 --> @sandeepk000 commented on GitHub (Mar 5, 2019): My Cloud MAnager class is like this import OAuthSwift import ObjectMapper class CloudManager { let errorResponse:DataResponse<Any>? = nil let stringErrorResponse: DataResponse<String>? = nil var accessToken: String? var oauthswift: OAuth2Swift? func makeCloudRequest(url:String,parameter:[String:Any],headers:[String:String],requestType:HTTPMethod ,completionHandler: @escaping (DataResponse<Any>?) -> Void ){ var method:OAuthSwiftHTTPRequest.Method? var parameters:[String:Any] = parameter if requestType == .post{ method = .POST }else if requestType == .get{ method = .GET parameters = [:] }else if requestType == .put{ method = .PUT } self.oauthswift = OAuth2Swift( consumerKey: StringConstant.oauth_client_id, // [1] Enter google app settings consumerSecret: KeychainService.shared[KEY_GOOGLE.KEY_NAME_OAUTH_CLIENT_SECRET]!, // No secret required authorizeUrl: RequestURL.URL_OAUTH_ACCESS_TOKEN.rawValue, accessTokenUrl: RequestURL.URL_OAUTH_ACCESS_TOKEN.rawValue, responseType: StringConstant.token ) if NetworkCheck.isNetwork() { let queue = DispatchQueue(label: "com.test.api", qos: .background, attributes: .concurrent) queue.async { self.oauthswift!.client.credential.oauthRefreshToken = MyDefaults.getData(key: DefaultKeys.KEY_REFRESH_TOKEN) as! String self.oauthswift!.startAuthorizedRequest(url, method: method!, parameters: parameters,headers:headers,onTokenRenewal: { (credential) in print(credential) MyDefaults.setData(value: credential.oauthToken, key: DefaultKeys.KEY_TOKEN) MyDefaults.setData(value:credential.oauthRefreshToken,key:DefaultKeys.KEY_REFRESH_TOKEN) }, success: { (response) in try? completionHandler(DataResponse(request: response.request, response: response.response, data: response.data, result: .success(try response.jsonObject()))) if url == RequestURL.URL_OAUTH_ACCESS_TOKEN.rawValue{ // if let responseParameters = try? response.jsonObject() as! [String:Any]{ // if let expiresIn = responseParameters["expires_in"] as? String, let offset = Double(expiresIn) { // self.oauthswift.client.credential.oauthTokenExpiresAt = Date(timeInterval: offset, since: Date()) // } else if let expiresIn = responseParameters["expires_in"] as? Double { // self.oauthswift.client.credential.oauthTokenExpiresAt = Date(timeInterval: expiresIn, since: Date()) // } // } self.oauthswift!.renewAccessToken(withRefreshToken: MyDefaults.getData(key: DefaultKeys.KEY_REFRESH_TOKEN) as! String, success: { (OAuthSwiftCredential, OAuthSwiftResponse, OAuthSwiftParameters) in MyDefaults.setData(value: OAuthSwiftCredential.oauthToken, key: DefaultKeys.KEY_TOKEN) }, failure: { (OAuthSwiftError) in }) } }, failure: { (OAuthSwiftError) in do{ let error = (OAuthSwiftError.errorUserInfo["error"] as! NSError).userInfo as! [String:Any] if let data = error[StringConstant.responseDataKey]{ let response = try JSONSerialization.jsonObject(with: data as! Data, options: []) completionHandler(DataResponse(request: OAuthSwiftError.errorUserInfo[StringConstant.request] as? URLRequest, response: error[StringConstant.responseKey] as? HTTPURLResponse, data: data as? Data, result: .success(response))) }else{ completionHandler(self.errorResponse) } } catch let error as NSError { print(error) } }) } }else{ if let view = Constants.appDelegate?.window?.rootView(){ ToastPopUp.showNetworkPOPup(message:ToastMsgConstant.network ,view: view) } completionHandler(errorResponse) } }
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

Please help Are u there?

<!-- gh-comment-id:469761978 --> @sandeepk000 commented on GitHub (Mar 5, 2019): Please help Are u there?
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

screen shot 2019-03-05 at 10 14 41 pm
screen shot 2019-03-05 at 10 15 07 pm
see these two screeen shots self is becoming nil

i am getting request response also but self is becoming nil

<!-- gh-comment-id:469790565 --> @sandeepk000 commented on GitHub (Mar 5, 2019): > ![screen shot 2019-03-05 at 10 14 41 pm](https://user-images.githubusercontent.com/46209817/53821764-6b55b700-3f94-11e9-9512-a3ea7d2b7966.png) > ![screen shot 2019-03-05 at 10 15 07 pm](https://user-images.githubusercontent.com/46209817/53821777-70b30180-3f94-11e9-9c85-4364d4a37385.png) > see these two screeen shots self is becoming nil i am getting request response also but self is becoming nil
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

No I didn't use instance of cloud manager like what I told but when I make request I am calling like Cloud manager().makeRequest()

<!-- gh-comment-id:469816376 --> @sandeepk000 commented on GitHub (Mar 5, 2019): No I didn't use instance of cloud manager like what I told but when I make request I am calling like Cloud manager().makeRequest()
Author
Owner

@sandeepk000 commented on GitHub (Mar 5, 2019):

Please help

<!-- gh-comment-id:469816504 --> @sandeepk000 commented on GitHub (Mar 5, 2019): Please help
Author
Owner

@phimage commented on GitHub (Mar 6, 2019):

No I didn't use instance of cloud manager like what I told but when I make request I am calling like Cloud manager().makeRequest()

so you do not retain any information, do not create the classe and lose it

please learn iOS memory management or do like I say with a singleton (event if it is not a good architecture)

<!-- gh-comment-id:470024913 --> @phimage commented on GitHub (Mar 6, 2019): > No I didn't use instance of cloud manager like what I told but when I make request I am calling like Cloud manager().makeRequest() so you do not retain any information, do not create the classe and lose it please learn iOS memory management or do like I say with a singleton (event if it is not a good architecture)
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#342
No description provided.