Can't retrieve users' e-mail address even with the app whitelisted and registered to Fabric


#1

Hi there,

I’m messing with social login in my iOS app. I have to say there’s a lot of movement in the documentations (Fabric, TwitterKit, ObjectiveC, Swift, Swift 2, Swift 3 and so on…) so I’m afraid I have to ask you help about it.

When I request the user’s e-mail address with the following code, it returns nil.

Twitter.sharedInstance().logIn { (session, error) in
         if session != nil {
            print("signed in as \(session!.userName)");
            let client = TWTRAPIClient.withCurrentUser()
            let request = client.urlRequest(withMethod: "GET",
                                            url: "https://api.twitter.com/1.1/account/verify_credentials.json",
                                            parameters: ["include_email": "true", "skip_status": "true"],
                                            error: nil)
            client.sendTwitterRequest(request) { response, data, connectionError in
                if (connectionError == nil) {
         
                    do{
                        let json = try JSONSerialization.jsonObject(with: data!, options: .allowFragments) as! [String:Any]
                        print("Json response: ", json)
                        let firstName = json["name"]
                        let lastName = json["screen_name"]
                        let email = json["email"]
                        print("First name: ",firstName)
                        print("Last name: ",lastName)
                        print("Email: ",email)
                    } catch {
         
                    }
         
                }
                else {
                    print("Error: \(connectionError)")
                }
            }

I’ve already registered the app to Fabric and whitelisted the app on Twitter.
I’ve already tried using Fabric consumerKey and secret and the Twitter ones as well.

Can anyone help, please?