0
我使用這些代碼接收用戶的電子郵件,但電子郵件沒有從twitter API.my帳戶得到驗證,我設置了準確的twitter應用程序設置。我的帳戶已驗證,我設置了精確的twitter應用程序設置。Twitter API電子郵件沒有得到IOS
- (IBAction)twitterLogin:(id)sender {
[[Twitter sharedInstance] logInWithCompletion:^
(TWTRSession *session, NSError *error) {
if (session) {
NSLog(@"signed in as %@", [session userName]);
NSLog(@"%@", [session userID]);
NSLog(@"%@", [session userName]);
NSLog(@"%@", [session authToken]);
NSLog(@"%@", [session authTokenSecret]);
TWTRAPIClient *client = [TWTRAPIClient clientWithCurrentUser];
NSURLRequest *request = [client URLRequestWithMethod:@"GET"
URL:@"https://api.twitter.com/1.1/account/verify_credentials.json"
parameters:@{@"include_email": @"true", @"skip_status": @"true"}
error:nil];
[client sendTwitterRequest:request completion:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
NSDictionary *result = [NSJSONSerialization
JSONObjectWithData:data
options:0
error:nil];
NSString * deviceToken = UD_getObj(@"deviceToken");
NSLog(@"%@",result);
[[AFHTTPRequestOperationManager manager]GET:DEF_URL(@"user/twitterLogin") parameters:@{@"name":result[@"first_name"],@"surname":@" ",@"gender":@" ",@"twID":result[@"id_str"],@"imageLink":result[@"profile_image_url"],@"email":result[@"email"],@"deviceToken":(deviceToken.length > 0 ? UD_getObj(@"deviceToken") : @" ")} success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"%@",responseObject);
UD_setObj(@"loginData", responseObject);
UD_sync();
[[AppDelegate sharedAppDelegate]hideLoadingView];
[[AppDelegate sharedAppDelegate]loginSuccess];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"%@",operation.responseString);
[[AppDelegate sharedAppDelegate]showMessage:@"Error" :@"An Error Occured Code : 80" :2 :self ];
[[AppDelegate sharedAppDelegate]hideLoadingView];
}];
}];
} else {
NSLog(@"error: %@", [error localizedDescription]);
}
}];
}
結果
2017-03-20 23:08:40.030206 Freger[652:180499] [core] Prepared Request URL: https://api.twitter.com/oauth/access_token
2017-03-20 23:08:40.981167 Freger[652:180499] signed in as Berkzsoy1
2017-03-20 23:08:40.981494 Freger[652:180499] 463092374
2017-03-20 23:08:40.981692 Freger[652:180499] Berkzsoy1
2017-03-20 23:08:40.981889 Freger[652:180499] 463092374-ZqlfFhJLAyowxdtNHyRFLopChO1h0zfp4NpkY171
2017-03-20 23:08:40.982080 Freger[652:180499] ydvwd3E3gvg7FKWxe4ILpKxY3NjSoQhtrxKtRSF6cbVeV
2017-03-20 23:08:41.304113 Freger[652:180499] {
"contributors_enabled" = 0;
"created_at" = "Fri Jan 13 18:22:19 +0000 2012";
"default_profile" = 0;
"default_profile_image" = 0;
description = "";
entities = {
description = {
urls = (
);
};
};
"favourites_count" = 24;
"follow_request_sent" = 0;
"followers_count" = 41;
following = 0;
"friends_count" = 104;
"geo_enabled" = 0;
"has_extended_profile" = 0;
id = 463092374;
"id_str" = 463092374;
"is_translation_enabled" = 0;
"is_translator" = 0;
lang = tr;
"listed_count" = 0;
location = "";
name = "Berk \U00d6zsoy";
notifications = 0;
"profile_background_color" = ABB8C2;
"profile_background_image_url" = "http://abs.twimg.com/images/themes/theme12/bg.gif";
"profile_background_image_url_https" = "https://abs.twimg.com/images/themes/theme12/bg.gif";
"profile_background_tile" = 0;
"profile_banner_url" = "https://pbs.twimg.com/profile_banners/463092374/1419816548";
"profile_image_url" = "http://pbs.twimg.com/profile_images/620996292135665664/XPuYYAEO_normal.jpg";
"profile_image_url_https" = "https://pbs.twimg.com/profile_images/620996292135665664/XPuYYAEO_normal.jpg";
"profile_link_color" = DD2E44;
"profile_sidebar_border_color" = EEEEEE;
"profile_sidebar_fill_color" = F6F6F6;
"profile_text_color" = 333333;
"profile_use_background_image" = 1;
protected = 0;
"screen_name" = Berkzsoy1;
"statuses_count" = 14;
"time_zone" = "<null>";
"translator_type" = none;
url = "<null>";
"utc_offset" = "<null>";
verified = 0;
}
然而,我激活了,oauth /授權對話框沒有彈出在我的應用程序。 – user3236289