簡體   English   中英

從ACAccountstore獲取Twitter用戶名 -

[英]Fetch Twitter usernames from 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);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM