无法获取用户';使用twitter fabric iOS框架从twitter发送电子邮件
我正在尝试新的iOS结构twitter工具包。 登录后,我们可以要求用户允许访问电子邮件id,如果允许,则返回登录用户的电子邮件,但它会给我错误无法获取用户';使用twitter fabric iOS框架从twitter发送电子邮件,ios,twitter,twitter-fabric,Ios,Twitter,Twitter Fabric,我正在尝试新的iOS结构twitter工具包。 登录后,我们可以要求用户允许访问电子邮件id,如果允许,则返回登录用户的电子邮件,但它会给我错误 Email (null), Error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x7fdd314f1c30 {NSUnderlyingError=0x7fdd314d9aa0 "The request timed out.", NSE
Email (null), Error: Error Domain=NSURLErrorDomain Code=-1001
"The request timed out." UserInfo=0x7fdd314f1c30
{NSUnderlyingError=0x7fdd314d9aa0 "The request timed out.",
NSErrorFailingURLStringKey=https://api.twitter.com/1.1/account/verify_cre
dentials.json?skip_status=true&include_email=true,
NSErrorFailingURLKey=https://api.twitter.com/1.1/account/verify_credentia
ls.json?skip_status=true&include_email=true,
NSLocalizedDescription=The request timed out.}
这是我的代码,我从他们的医生那里试过
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 {
// TODO: Handle user not signed in (e.g.
// attempt to log in or show an alert)
}
我的代码有什么问题吗?请帮帮我。
我可以将我的状态和媒体发布到twitter,但无法获取电子邮件Id
有人能帮我解决这个问题吗?我也是开发新手。要获取用户电子邮件地址,您的应用程序应该被列入白名单。这是你的电话号码。去。您可以向sdk发送邮件-feedback@twitter.com有关您的应用程序的一些详细信息,如消费者密钥、应用程序的应用程序商店链接、隐私政策链接、元数据、如何登录我们的应用程序的说明等。他们将在2-3个工作日内作出响应 以下是我如何通过与Twitter支持团队的对话被列入白名单的故事:
- 将邮件发送到
提供有关应用程序的一些详细信息,如消费者密钥、应用程序的应用商店链接、隐私政策链接、元数据、如何登录我们的应用程序的说明。在邮件中提及您希望访问应用程序中的用户电子邮件地址sdk-feedback@twitter.com
- 他们将审查你的应用程序,并在2-3个工作日内回复你
- 一旦他们说你的应用程序被列入白名单,请在Twitter开发者门户中更新你的应用程序设置。登录并:
- 在“设置”选项卡上,添加服务条款和隐私策略URL
- 在“权限”选项卡上,将令牌的作用域更改为请求电子邮件。只有当您的应用程序被列入白名单时,才会看到此选项
-(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 {
// Handle user not signed in (e.g. attempt to log in or show an alert)
}
}
获取用户配置文件
-(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) {
// handle the response data e.g.
NSError *jsonError;
NSDictionary *json = [NSJSONSerialization
JSONObjectWithData:data
options:0
error:&jsonError];
NSLog(@"%@",[json description]);
}
else {
NSLog(@"Error code: %ld | Error description: %@", (long)[connectionError code], [connectionError localizedDescription]);
}
}];
}
else {
NSLog(@"Error: %@", clientError);
}
}
希望对你有帮助 你的申请被推特列入白名单了吗?我不明白,白名单是什么意思,我不这么认为