ios - 从 ACAccountstore 获取 Twitter 用户名 -

标签 ios iphone objective-c twitter acaccountstore

我将 ACAccount 存储在数组中作为 -

 NSArray *arrayOfAccounts = [accountStore accountsWithAccountType:accountType];

通过打印 arrayOfAccounts -

  (
  "type:com.apple.twitter\nidentifier: 9E8DD039-D210-49EB-90D3-797017EC9F37\naccountDescription: @kaleshnewage\nusername: kaleshnewage\nobjectID: x-coredata://8CD38D83-7C1C-4542-BE4B-7007B6586675/Account/p24\nenabledDataclasses: {(\n)}\nenableAndSyncableDataclasses: {(\n)}\nproperties: {\n    \"user_id\" = 1407688573;\n}\nparentAccount: (null)\nowningBundleID:(null)",
"type:com.apple.twitter\nidentifier: 888F056F-8BB2-4847-91D3-CFFE93770F01\naccountDescription: @dasarun5\nusername: dasarun5\nobjectID: x-coredata://8CD38D83-7C1C-4542-BE4B-7007B6586675/Account/p25\nenabledDataclasses: {(\n)}\nenableAndSyncableDataclasses: {(\n)}\nproperties: {\n    \"user_id\" = 120014192;\n}\nparentAccount: (null)\nowningBundleID:(null)",
"type:com.apple.twitter\nidentifier: 3BB57617-0436-4801-B302-CE7C67D2E2A5\naccountDescription: @arunjoseph700\nusername: arunjoseph700\nobjectID: x-coredata://8CD38D83-7C1C-4542-BE4B-7007B6586675/Account/p28\nenabledDataclasses: {(\n)}\nenableAndSyncableDataclasses: {(\n)}\nproperties: {\n    \"user_id\" = 1068508537;\n}\nparentAccount: (null)\nowningBundleID:(null)"
)

现在我只想将用户名放入另一个数组,该怎么做?

最佳答案

accountsWithAccountType: 返回一个 ACAccount 数组,因此您可以这样做:

for (ACAccount *account in arrayOfAccounts) {
    NSLog(@"Username: %@", account.username);
}

关于ios - 从 ACAccountstore 获取 Twitter 用户名 -,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19688951/

相关文章:

ios - iPad 上的 UIActivityViewController 奇怪行为,App 未优化

ios - Swift 类中的可选 let 和可选 var

ios - 在带有 Core Data 的 IOS 应用程序中,我应该将业务逻辑放在哪里?

iphone - 如何在越狱 iphone 上读取 cout/调试跟踪,同时在设备上进行测试

iphone - 异步请求和委托(delegate)可能存在的风险

iphone - 接收滚动方向,power ios

objective-c - 使用 Paul de Casteljau 算法在 Objective C 中创建贝塞尔曲线

ios - 是否可以制作类型为 'aufc' (kAudioUnitType_FormatConverter) 的 AUv3 扩展?

iphone - UITableView 正在加载每个单元格

iphone - 创建像人手一样的自定义按钮