ios - iOS 模拟器默认有一个 ACAccount 存储吗?

标签 ios

iOS 模拟器是否默认有一个 ACAccount 存储,是否可以操纵它来测试 ACAccountStore 和 ACAccount API?

最佳答案

我想你想知道是否有人可以在他们的代码中使用 ACaccounts,同时在模拟器上进行测试。 是的,我们可以使用 ACaccounts。

在模拟器中添加帐户:

您实际上可以转到 iOS 模拟器上的“设置”应用并添加帐户 - 就像使用真正的手机一样。

例如,如果有人想使用所有 Twitter 帐户:

ACAccountStore *accountStore = [[ACAccountStore alloc] init] ;
ACAccountType *twitterAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
NSArray *twitterAccounts = [accountStore accountsWithAccountType:twitterAccountType];

if(twitterAccounts)
{
    NSLog(@"twitterAccounts: %@",twitterAccounts);
}

关于ios - iOS 模拟器默认有一个 ACAccount 存储吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31825933/

相关文章:

ios - 检索核心数据关系的计数

ios - URLSession.shared 请求崩溃 Swift 3

ios - UIStackView 和手势

ios - 获取应用程序本身的 iOS iTunes App Store ID?

ios - 识别 Facebook Chat 中的聊天客户端应用程序

ios - 在sqlite中是否必须使用“END TRANSACTION”

ios - 尝试使用 CIFilter 旋转/裁剪图像时,createCGImage 返回 nil

ios - NSDateFormatter : 12 hour formatted string can't converted in date when system date format is 24 hour in ios

ios - UITableView 复选标记重复

ios - 启用两个类之间的双向通信