若想要透过 Visual Studio 开发 .NET MAUI 并进行 iOS 应用程式的开发,势必要在 Visual Studio 当中登入 Apple Developer Account,以利取得凭证等资讯。
取得相关资讯后,在进行 iOS 应用程式部署的时候(安装到测试实机上) 或是打包发版(发布到 AppStore Connect)的时候,都会相对简便。
不过,现在不再支援直接使用登入帐号密码的方式使用。
请改用 Apple Developer 的 API Key 来存取啰!
在 Visual Studio 的工具列中,工具 → 选项:
在出现的 "选项" 视窗中,透过搜寻 "Xamarin" 后在出现的选项中,找到 "Apple Account":
在 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":
接着在 Apple Developer Accounts 当中就会看到出现可选的列表:
点选所使用的 API Key 就会看到详细资讯:
点选 "View Details…"
就可以取得 "Certificate" 跟 "Provisioning Profiles",甚至如果想要直接透过 VS 来 "Create Certificate" 也是可以(但不太建议这么做):
以上~~~
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" 软体製作。