# å¸å·å系统changeLog ## cl.account_os_account.1 createOsAccountForDomain错误ç å˜æ›´ 使用createOsAccountForDomainé‡å¤åˆ›å»ºåŸŸå¸å·æ—¶ï¼Œå˜æ›´å‰è¿”回的错误ç 为12300001ï¼Œå˜æ›´åŽè¿”回的错误ç 为12300004。 错误信æ¯ç”±é€šç”¨ç³»ç»ŸæŠ¥é”™ç»†åŒ–为å¸å·å·²å˜åœ¨æŠ¥é”™ã€‚ **å˜æ›´å½±å“** 基于æ¤å‰ç‰ˆæœ¬å¼€å‘的应用,需适é…å˜æ›´åŽçš„错误ç ,å¦åˆ™ä¼šå½±å“原有业务逻辑。 **关键接å£/ç»„ä»¶å˜æ›´** - AccountManager - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback<OsAccountInfo>); - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise<OsAccountInfo>; **适酿Œ‡å¯¼** é‡å¤åˆ›å»ºåŸŸå¸å·çš„示例代ç 如下: ```ts import account_osAccount from "@ohos.account.osAccount" let accountMgr = account_osAccount.getAccountManager(); let domainInfo = { accountName: "zhangsan", domain: "china.example.com" }; try { await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo); await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo); } catch (err) { console.log("activateOsAccount err: " + JSON.stringify(err)); // error.code = 12300004; } ``` ## cl.account_os_account.2 应用å¸å·getAllAccountsæŽ¥å£æƒé™åœºæ™¯å˜æ›´ 应用使用getAllAccountsæŽ¥å£æŸ¥è¯¢è‡ªå·±å¯è®¿é—®çš„å¸å·åˆ—表时,ä¸éœ€è¦ç”³è¯·æƒé™ohos.permission.GET_ALL_APP_ACCOUNTS。 **å˜æ›´å½±å“** 基于æ¤åŽç‰ˆæœ¬å¼€å‘的应用,查询自己å¯è®¿é—®çš„å¸å·åˆ—è¡¨æ—¶ï¼Œæ— éœ€ç”³è¯·æƒé™ã€‚ **关键接å£/ç»„ä»¶å˜æ›´** - AccountManager - getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void; - getAllAccounts(): Promise<Array<AppAccountInfo>>; **适酿Œ‡å¯¼** 应用未申请ohos.permission.GET_ALL_APP_ACCOUNTS,查询自己å¯è®¿é—®çš„å¸å·åˆ—表示例代ç 如下: ```ts import account_appAccount from "@ohos.account.appAccount" let accountMgr = account_appAccount.createAppAccountManager(); try { await accountMgr.addAccount("accessibleAccount_promise_nopermission"); var data = await accountMgr.getAllAccounts(); if (data[0].name == "accessibleAccount_promise_nopermission") { console.log("getAllAccounts successfully"); } } catch (err) { console.log("getAllAccounts err: " + JSON.stringify(err)); } ``` ## cl.account_os_account.3 应用å¸å·getAccountsByOwneræŽ¥å£æƒé™åœºæ™¯å˜æ›´ 应用使用getAccountsByOwneræŽ¥å£æŸ¥è¯¢å¯è®¿é—®çš„æŒ‡å®šåº”用的å¸å·åˆ—表时,ä¸éœ€è¦ç”³è¯·æƒé™ohos.permission.GET_ALL_APP_ACCOUNTS。 **å˜æ›´å½±å“** 基于æ¤åŽç‰ˆæœ¬å¼€å‘的应用,查询指定应用å¯è®¿é—®çš„å¸å·åˆ—è¡¨æ—¶ï¼Œæ— éœ€ç”³è¯·æƒé™ã€‚ **关键接å£/ç»„ä»¶å˜æ›´** - AccountManager - getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccountInfo>>): void; - getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>>; **适酿Œ‡å¯¼** 应用未申请ohos.permission.GET_ALL_APP_ACCOUNTS,查询指定应用å¯è®¿é—®çš„å¸å·åˆ—表示例代ç 如下: ```ts import account_appAccount from "@ohos.account.appAccount" let accountMgr = account_appAccount.createAppAccountManager(); try { var ownerName = "com.example.owner"; var data = await accountMgr.getAllAccounts(ownerName); } catch (err) { console.log("getAllAccounts err: " + JSON.stringify(err)); } ```