6

複数の SDK を試しましたが、どのリソースからもメール ID を取得できませんでした。この目的のために試しFHSTwitterEngineましたが、解決策が得られませんでした。

FHSTwitterEngine *twitterEngine = [FHSTwitterEngine sharedEngine];
NSString *username = [twitterEngine loggedInUsername]; //self.engine.loggedInUsername;
NSString *key = [twitterEngine accessToken].key;
NSString *secrete = [twitterEngine accessToken].secret;

if (username.length > 0)
{
    NSDictionary *userProfile = [[FHSTwitterEngine sharedEngine] getProfileUsername:username];
    NSLog(@"userProfile: %@", userProfile);
4

5 に答える 5

0

スイフト 3-4

@IBAction func btnTwitterAction(_ sender: Any) {

        TWTRTwitter.sharedInstance().logIn(completion: { (session, error) in
            if (session != nil) {
                print("signed in as \(String(describing: session?.userName))");
                if let mySession = session{

                    let client = TWTRAPIClient.withCurrentUser()
                    //To get User name and email
                    client.requestEmail { email, error in
                        if (email != nil) {
                            print("signed in as \(String(describing: session?.userName))");
                            let firstName = session?.userName ?? ""   // received first name
                            let lastName = session?.userName ?? ""  // received last name
                            let recivedEmailID = email ?? ""   // received email

                        }else {
                            print("error: \(String(describing: error?.localizedDescription))");
                        }
                    }


                    //To get user profile picture
                    client.loadUser(withID: session?.userID, completion: { (userData, error) in
                        if (userData != nil) {

                            let fullName = userData.name //Full Name
                            let userProfileImage = userData.profileImageLargeURL //User Profile Image
                            let userTwitterProfileUrl = userData?.profileURL // User TwitterProfileUrl
                        }
                    })
                }
            } else {
                print("error: \(error?.localizedDescription)");
            }
        })

    }
于 2019-09-11T12:01:41.133 に答える