若想要透過 Visual Studio 開發 .NET MAUI 並進行 iOS 應用程式的開發,勢必要在 Visual Studio 當中登入 Apple Developer Account,以利取得憑證等資訊。
取得相關資訊後,在進行 iOS 應用程式部署的時候(安裝到測試實機上) 或是打包發版(發佈到 AppStore Connect)的時候,都會相對簡便。
不過,現在不再支援直接使用登入帳號密碼的方式使用。
請改用 Apple Developer 的 API Key 來存取囉!
在 Visual Studio 的工具列中,工具 → 選項:

在出現的 "選項" 視窗中,透過搜尋 "Xamarin" 後在出現的選項中,找到 "Apple Accounts":

在 Apple Developer Accounts 的畫面中,點選 "Add":

接著就會出現如下畫面:

啥?這啥…
(第一次看到時確實有這個疑問)
基本上,就是 Apple 強制第三方軟體需透過 API Key 去登入 Apple Developer Account 後,才能存取 Apple Developer 的相關資訊。
所以回到 Apple Developer 網站。
點選 "Users and Access":

然後就會自動轉跳到 AppleStore Connect 的網站的 "使用者與存取權限"。
點選 "整合":

點選 App Store Connect API,並確認在 "團隊金鑰" 的部分(Visual Studio "目前" 僅支援使用團隊金鑰),再點選 "產生 API 金鑰" (如果曾經啟用過,要再產生新的請點選 "+"):

產生 API 金鑰的畫面中請輸入 "名稱"(任意取一個自己短期記憶內能識別的名稱即可) 與 "存取權限" (請詳細了解 Apple 的權限設計後再選擇)後,點選 "產生":

產生後,就可以看到多出了一個 API 金鑰,可點選 "下載":

注意, API 金鑰只能下載一次。
下載的該檔案請妥善保存:

若遺失,則須重新產生 API 金鑰。

再次回到 Visual Studio 2022 的該畫面,依序填入相關資訊後,點選 "Add":

請對照上圖與上上圖的 1、2、3、4 進行填寫。
接著在 Apple Developer Accounts 當中就會看到出現可選的列表:

點選所使用的 API Key 就會看到詳細資訊:

點選 "View Details…"
就可以取得 "Certificate" 跟 "Provisioning Profiles",甚至如果想要直接透過 VS 來 "Create Certificate" 也是可以(但不太建議這麼做):

以上~~~
推測看倌接下來會有興趣的文章:
Visual Studio 存取 Apple Developer Account 但憑證卻不在 Keychain 當中
I'm a Microsoft MVP - Developer Technologies (From 2015 ~).

I focus on the following topics: Xamarin Technology, Azure, Mobile DevOps, and Microsoft EM+S.
If you want to know more about them, welcome to my website:
https://jamestsai.tw
本部落格文章之圖片相關後製處理皆透過 Techsmith 公司 所贊助其授權使用之 "Snagit" 與 "Snagit Editor" 軟體製作。