This is profile_image_url_https;)
We can get a profile picture without using ssh s Twitter. Using social infrastructure in iOS we can use.
I use ACAccounts instead of the Twitter IOS SDK, for example MGTwitterEngine , etc ........ The Twitter account provided in the IPhone settings will be used.
if(!accountStore) accountStore = [[ACAccountStore alloc] init]; ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; [accountStore requestAccessToAccountsWithType:accountType options:NULL completion:^(BOOL granted, NSError *error) { if (granted) { // Step 2: Create a request NSArray *accountsArray = [accountStore accountsWithAccountType:accountType]; self.twitterAccount = [accountsArray objectAtIndex:0]; // NSString *userID = [[twitterAccount valueForKey:@"properties"] valueForKey:@"user_id"]; NSURL *url = [NSURL URLWithString:@"https://api.twitter.com/1.1/users/show.json"]; NSDictionary *params = @{@"screen_name" : twitterAccount.username }; SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:url parameters:params]; // Attach an account to the request [request setAccount:[accountsArray lastObject]]; // Step 3: Execute the request [request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { if (responseData) { if (urlResponse.statusCode >= 200 && urlResponse.statusCode < 300) { [self performSelectorOnMainThread:@selector(twitterdetails:) withObject:responseData waitUntilDone:YES]; } else { NSLog(@"The response status code is %d", urlResponse.statusCode); } } }]; } else { dispatch_async(dispatch_get_main_queue(), ^{ [self dismissError:@"Please set up your twitter account in iphone settings"]; }); } }]; -(void)twitterdetails:(NSData *)responseData { NSError* error = nil; NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData //1 options:NSJSONReadingAllowFragments error:&error]; NSString *name = [json objectForKey:@"name"]; NSString *scrnm = [json objectForKey:@"screen_name"]; NSString *twitterid = [json objectForKey:@"id"]; NSString *prof_img = [json objectForKey:@"profile_image_url"]; NSString *location = [json objectForKey:@"location"]; }
Debanjan Chakraborty Sep 24 '13 at 17:10 2013-09-24 17:10
source share