Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leaks while fetching last 10 mails #81

Open
GarabaIgor opened this issue Nov 5, 2018 · 2 comments
Open

Memory leaks while fetching last 10 mails #81

GarabaIgor opened this issue Nov 5, 2018 · 2 comments

Comments

@GarabaIgor
Copy link

I have simple iOS app which connect to my gmail and get last 10 emails:

private lazy var oauthswift:OAuth2Swift = {
        let tempOauthswift = OAuth2Swift(
            consumerKey:    "MY_SECRET_KEY",
            consumerSecret: "",
            authorizeUrl:   "https://accounts.google.com/o/oauth2/v2/auth",
            accessTokenUrl: "https://accounts.google.com/o/oauth2/token",//!!!!!!!!!!!!!!!!!
            responseType:   "code"
        )
        tempOauthswift.allowMissingStateCheck = true
        return tempOauthswift
    }()
    
    @IBAction func tap(_ sender: Any) {
        oauthswift.authorize(
            withCallbackURL: URL(string: "MY_CALLBACK_URL:/oauth2Callback")!,
            scope: "https://mail.google.com/", state:"",
            success:
            {
                (credential, response, parameters) in
                let configuration = Configuration.gmail(login: "[email protected]", password: .accessToken(credential.oauthToken))
                print(credential.oauthToken)
                let postal = Postal(configuration: configuration)
                postal.connect { result in
                    switch result {
                    case .success:
                        print("success")
                    case .failure(let error):
                        print("error: \(error)")
                    }
                }
                postal.fetchLast("INBOX", last: 10, flags: [.body], onMessage: { (FetchResult) in
                    print(FetchResult)
                }, onComplete: { (PostalError) in
                    print(PostalError
.debugDescription)
                })
        },
            failure:
            { error in
                print("Error: \(error.localizedDescription)")
        })
    } 

My app fetches emails successfully but Instruments shows leaks:
postal_leaks

Any ideas?

@GarabaIgor
Copy link
Author

Does anybody have such problem with leaks? May be I must close cfstream, but how to do it ?

@GarabaIgor
Copy link
Author

I've returned to my old project and rebuild it with new version of postal. Memory leaks are still here. May be it's false positive leak or I do something wrong? Does anybody has such problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant