TwitterKit 框架未获取电子邮件密钥
TwitterKit framework is not getting email key
我正在使用 Fabric 的 TwitterKit 框架和版本 2.8.0。我已按照 https://docs.fabric.io/apple/twitter/log-in-with-twitter.html#request-user-email-address 的说明进行操作
并且已经检查了请求用户访问电子邮件地址的权限。但是有时我根本没有得到 "verify_credentials" 响应,有时我没有得到 verify_credentials API 响应中的 "email" 键。
使用 Fabric 登录 Twitter。请使用以下代码
- (IBAction)TwitteClickAction:(id)sender
{
[[Twitter sharedInstance] logInWithMethods:TWTRLoginMethodWebBased completion:^(TWTRSession *session, NSError *error)
{
if (session)
{
NSLog(@"signed in as %@", [session userName]);
NSLog(@"signed id in as %@", [session userID]);
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)
{
if (data)
{
NSError *jsonError;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
NSLog(@"info is ====>%@",json);
}
else {
NSLog(@"Error: %@", connectionError);
}
}];
} else {
NSLog(@"error: %@", [error localizedDescription]);
}
}];
}
我正在使用 Fabric 的 TwitterKit 框架和版本 2.8.0。我已按照 https://docs.fabric.io/apple/twitter/log-in-with-twitter.html#request-user-email-address 的说明进行操作 并且已经检查了请求用户访问电子邮件地址的权限。但是有时我根本没有得到 "verify_credentials" 响应,有时我没有得到 verify_credentials API 响应中的 "email" 键。
使用 Fabric 登录 Twitter。请使用以下代码
- (IBAction)TwitteClickAction:(id)sender
{
[[Twitter sharedInstance] logInWithMethods:TWTRLoginMethodWebBased completion:^(TWTRSession *session, NSError *error)
{
if (session)
{
NSLog(@"signed in as %@", [session userName]);
NSLog(@"signed id in as %@", [session userID]);
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)
{
if (data)
{
NSError *jsonError;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
NSLog(@"info is ====>%@",json);
}
else {
NSLog(@"Error: %@", connectionError);
}
}];
} else {
NSLog(@"error: %@", [error localizedDescription]);
}
}];
}