You will need to use the Twitter platform. Twitter has provided an excellent infrastructure for this, you just need to integrate it into your application.
To get the user's email address, your application must be in the white list. Here's the link . Go to use this form . You can send mail to sdk-feedback@twitter.com with some details about your application, for example, in the section "Consumer Key", "App Store" in the application, "Privacy Policy Link", "Metadata", "Instructions for logging into our application, etc. " reply within 2-3 business days.
Here is the story of how I got a whitelist chat with the Twitter support team:
Send an email to sdk-feedback@twitter.com with some details about your application, for example, in the section "Consumer Key", in the application "Application Store", "Link to Privacy Policy", "Metadata", "Instructions for logging into our Appendix". Mention in the mail that you want to access the user's email address in your application.
They will review your application and respond to you in 2-3 business days.
Once they say your application is whitelisted, update your application’s settings on the Twitter developer portal. Sign in to apps.twitter.com and:
- On the Settings tab, add the URL of the terms of service and privacy policy
- On the Permissions tab, change the token area for the email request. This option will be displayed only after your application is included in the white list.
Put your hands on the code
Using the Twitter framework:
Get user email address
-(void)requestUserEmail { if ([[Twitter sharedInstance] session]) { TWTRShareEmailViewController *shareEmailViewController = [[TWTRShareEmailViewController alloc] initWithCompletion:^(NSString *email, NSError *error) { NSLog(@"Email %@ | Error: %@", email, error); }]; [self presentViewController:shareEmailViewController animated:YES completion:nil]; } else {
Get user profile
-(void)usersShow:(NSString *)userID { NSString *statusesShowEndpoint = @"https://api.twitter.com/1.1/users/show.json"; NSDictionary *params = @{@"user_id": userID}; NSError *clientError; NSURLRequest *request = [[[Twitter sharedInstance] APIClient] URLRequestWithMethod:@"GET" URL:statusesShowEndpoint parameters:params error:&clientError]; if (request) { [[[Twitter sharedInstance] APIClient] sendTwitterRequest:request completion:^(NSURLResponse *response, NSData *data, NSError *connectionError) { if (data) {
Hope this helps !!!
NSPratik May 26 '15 at 11:02 2015-05-26 11:02
source share