Ios 如何使用Objective-C从安装在设备上的本机twitter应用程序获取用户详细信息
我已经使用FSHTwitterEngine在我的iOS应用程序中实现了twitter登录。我还实现了使用ACAccountStore检查系统帐户的功能 在用户通过这两种方式登录之前,按下按钮,我如何检查用户是否已经登录到twitter本机应用程序,如果已经登录,如何从那里获取用户数据,然后返回到我的应用程序。 (与facebook的FBSDKLoginBehaviorNative相同。)Ios 如何使用Objective-C从安装在设备上的本机twitter应用程序获取用户详细信息,ios,objective-c,twitter,Ios,Objective C,Twitter,我已经使用FSHTwitterEngine在我的iOS应用程序中实现了twitter登录。我还实现了使用ACAccountStore检查系统帐户的功能 在用户通过这两种方式登录之前,按下按钮,我如何检查用户是否已经登录到twitter本机应用程序,如果已经登录,如何从那里获取用户数据,然后返回到我的应用程序。 (与facebook的FBSDKLoginBehaviorNative相同。) 从上面的代码中,您可以使用ACAccountStore检查用户的手机中是否有twitter帐户。此代码用于从
从上面的代码中,您可以使用ACAccountStore检查用户的手机中是否有twitter帐户。此代码用于从设备设置中的系统帐户获取详细信息。我想从已安装的twitter应用程序中获取详细信息。
BOOL twInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitter://"]];
if (twInstalled)
{
// here I want to check for the user if he/she is logged in and get data.
}
else
{
[self twitterLoginWithsystemAccount]
// or
[self twitterLoginWithFHSTwitterEngine];
}
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
NSArray *accounts = [accountStore accountsWithAccountType:accountType];
ACAccount *twitterAccount = [accounts lastObject];