共用方式為


iOS 權利

在 iOS 上,.NET 多平臺應用程式 UI (.NET MAUI) 應用程式會在沙箱中執行,提供一組規則來限制應用程式與系統資源或使用者數據之間的存取。 權利可用來要求擴充沙盒,以提供您的應用程式額外的功能,例如與 Siri 整合。 應用程式使用的任何權利都必須在應用程式的 Entitlements.plist 檔案中指定。 如需權利的詳細資訊,請參閱 developer.apple.com 權利。

除了指定權利之外, Entitlements.plist 檔案也會用來撰寫簽署應用程式的程序代碼。 簽署應用程式的程式代碼時,權利檔案會結合Apple開發人員帳戶中的資訊,以及其他項目資訊,以將最後一組權利套用至您的應用程式。

權利與功能的概念密切相關。 它們都會要求擴充應用程式執行中的沙箱,以提供額外的功能。 開發應用程式時通常會新增權利,而功能通常會在程式代碼簽署應用程式以進行散發時新增。 不過,啟用自動布建時,將特定權利新增至您的應用程式也會在其布建配置檔中更新應用程式的功能。 如需詳細資訊,請參閱 使用Visual Studio新增功能。

重要

Entitlements.plist 檔案未連結至 Apple 開發人員帳戶。 因此,為您的應用程式建立布建配置檔時,您應該確定應用程式所使用的任何權利也會指定為其布建配置檔中的功能。 如需詳細資訊,請參閱功能

新增 Entitlements.plist 檔案

若要將新的權利檔案新增至 .NET MAUI 應用程式專案,請將名為 Entitlements.plist 的新 XML 檔案新增至 應用程式專案的 Platform\iOS 資料夾。 然後將下列 XML 新增至 檔案:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

設定權利

您可以按兩下 Entitlements.plist 檔案,在權利編輯器中開啟權利,在Visual Studio 中設定權利。

  1. 方案總管 中,從 .NET MAUI 應用程式專案的 [平臺 iOS] > 資料夾中按兩下 Entitlements.plist 檔案,以在權利編輯器中開啟它。

  2. 在權利編輯器中,選取並設定應用程式所需的任何權利:

    Visual Studio iOS entitlements editor.

  3. 將變更儲存至您的 Entitlements.plist 檔案,以將權利索引鍵/值組新增至檔案。

某些權利可能也需要在 Info.plist設定隱私權密鑰。

取用權利

.NET MAUI iOS 應用程式必須設定為取用 Entitlements.plist 檔案中定義的權利。

  1. 方案總管 中,以滑鼠右鍵按兩下 .NET MAUI 應用程式項目,然後選取 [屬性]。 然後,流覽至 [iOS 套件組合簽署] > 索引標籤。

  2. 在 [套件組合簽署設定] 中,按兩下 [自定義權利] 字段的 [流覽...] 按鈕。

  3. 在 [ 自定義權利] 對話框中,流覽至包含您的 Entitlements.plist 檔案的資料夾,選取檔案,然後按兩下 [ 開啟 ] 按鈕。

  4. 在項目屬性中, [自定義權利] 字段會填入您的權利檔案:

    Visual Studio custom entitlements field set.

  5. 關閉項目屬性。

注意

Visual Studio 會為偵錯和發行組建設定自定義權利字段。

啟用自動布建時,也會將權利子集新增至應用程式的布建配置檔作為功能。 如需詳細資訊,請參閱 使用Visual Studio新增功能。

索引鍵參考

權利索引鍵/值組如下所列以供參考。 在 Visual Studio 中,您可以將 Entitlements.plist 檔案編輯為 XML 檔案來新增它們。 在 Visual Studio for Mac 中,您可以透過 權利編輯器的 [來源 ] 檢視來新增它們。

存取WiFi資訊

此存取WiFi資訊權利可讓您的應用程式取得目前連線WiFi網路的相關信息。

權利是使用 com.apple.developer.networking.wifi-info 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.networking.wifi-info</key>
<true/>

如需詳細資訊,請參閱 存取 developer.apple.com 的WiFi信息權利

應用程式證明

透過應用程式證明權利,您可以在裝置上產生特殊的密碼編譯密鑰,並在伺服器提供敏感數據的存取權之前,使用它來驗證應用程式的完整性。

權利是使用 com.apple.developer.devicecheck.appattest-environment 類型的 String索引鍵來定義:

<key>com.apple.developer.devicecheck.appattest-environment</key>
<string>development</string>

如需詳細資訊,請參閱 developer.apple.com 上的應用程式證明環境

應用程式群組

應用程式群組權利可讓您的應用程式存取多個相關應用程式之間共用的群組容器,以及執行應用程式之間的進程間通訊。

權利是使用 com.apple.security.application-groupsArrayString別的索引鍵來定義:

<key>com.apple.security.application-groups</key>
<array>
  <string>group.MyAppGroups</string>
</array>

如需詳細資訊,請參閱 developer.apple.com 上的應用程式群組權利

Apple Pay

Apple Pay 權利可讓使用者使用儲存在其裝置上的付款資訊,輕鬆且安全地支付實體權益和服務,例如雜貨、服裝、票證和預訂。

權利是使用 com.apple.developer.in-app-paymentsArrayString別的索引鍵來定義:

<key>com.apple.developer.in-app-payments</key>
<array>
  <string>merchant.your.merchantid</string>
</array>

如需詳細資訊,請參閱 developer.apple.com 上的商家標識符權利

相關聯的網域

相關聯的網域權利可讓您的應用程式與特定服務的特定網域相關聯,例如存取Safari、儲存的密碼和活動接續。

權利是使用 com.apple.developer.associated-domainsArrayString別的索引鍵來定義:

<key>com.apple.developer.associated-domains</key>
<array>
  <string>webcredentials:example.com</string>
</array>

如需詳細資訊,請參閱 developer.apple.com 的相關網域權利

AutoFill 認證提供者

AutoFill 認證提供者權利可讓具有使用者許可權的應用程式提供自動填入應用程式和 Safari 的使用者名稱和密碼。

權利是使用 com.apple.developer.authentication-services.autofill-credential-provider 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.authentication-services.autofill-credential-provider</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的自動填入認證提供者權利

ClassKit

ClassKit 權利可讓您的應用程式在受學校管理的環境中私下安全地與教師分享學生進度,例如在書籍中閱讀章節或接受測驗。

權利是使用 com.apple.developer.ClassKit-environment 類型的 String索引鍵來定義:

<key>com.apple.developer.ClassKit-environment</key>
<string>development</string>

如需詳細資訊,請參閱 developer.apple.com 上的 ClassKit 環境權利

與驅動程序通訊

與驅動程式權利通訊可啟用應用程式與 DriverKit 驅動程式之間的通訊。

權利是使用 com.apple.developer.driverkit.communicates-with-drivers 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.driverkit.communicates-with-drivers</key>
<true/>

如需詳細資訊,請參閱 與 developer.apple.com 上的驅動程序 通訊。

通訊通知

通訊通知權利可讓應用程式將通訊通知從人員傳送給個人或多人。

權利是使用 com.apple.developer.usernotifications.communication 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.usernotifications.communication</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的要求通知服務權利

資料保護

數據保護權利可讓您的應用程式在支援的裝置上使用內建加密。 當您將檔案指定為受保護時,系統會以加密格式儲存盤案。

權利是使用 com.apple.developer.default-data-protection 類型的 String索引鍵來定義:

<key>com.apple.developer.default-data-protection</key>
<string>NSFileProtectionComplete</string>

如需詳細資訊,請參閱 developer.apple.com 上的數據保護權利

擴充虛擬尋址

延伸的虛擬尋址權利可讓您在應用程式中使用更多位址空間。

權利是使用 com.apple.developer.kernel.extended-virtual-addressing 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.kernel.extended-virtual-addressing</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的擴充虛擬尋址權利

系列控件

家庭控制權利可在您的應用程式中啟用家長控制,並授與 ScreenTime API 中受控 設定 和裝置活動架構的存取權。 使用家庭控制項需要家庭共用進行用戶註冊。 它可防止移除您的應用程式,並啟用來自網路延伸模組的裝置內容篩選。

權利是使用 com.apple.developer.family-controls 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.family-controls</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的家庭控制權利

FileProvider 測試模式

FileProvider 測試模式權利可啟用測試模式,讓檔案提供者延伸模組在測試期間更充分地控制系統的行為。

權利是使用 com.apple.developer.fileprovider.testing-mode 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.fileprovider.testing-mode</key>
<true/>

如需詳細資訊,請參閱 fileProvider Testing Mode Entitlement on developer.apple.com。

字型

字型權利可讓您的應用程式具有使用者許可權,安裝及使用自定義字型。

權利是使用 com.apple.developer.user-fontsArrayString別的索引鍵來定義:

<key>com.apple.developer.user-fonts</key>
<array>
  <string>system-installation</string>
</array>

如需詳細資訊,請參閱 在 developer.apple.com 上設定自定義字型

群組活動

群組活動權利可讓應用程式與一或多個其他裝置上的相同應用程式通訊,以在 FaceTime 通話中建立群組活動。 FaceTime 上的群組活動可讓使用者一起觀看影片、一起聆聽音樂,或執行另一個同步活動。

權利是使用 com.apple.developer.group-session 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.group-session</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的群組活動權利

HealthKit

HealthKit 權利可讓您的應用程式存取用戶權力、個人健康情況資訊。

權利是使用 com.apple.developer.healthkit 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.healthkit</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的 HealthKit 權利

HomeKit

HomeKit 權利可讓您的應用程式與 HomeKit 配件互動。

權利是使用 com.apple.developer.homekit 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.homekit</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的 HomeKit 權利

熱點組態

熱點設定權利權利可讓您的應用程式設定WiFi網路。

權利是使用 com.apple.developer.networking.HotspotConfiguration 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.networking.HotspotConfiguration</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的熱點設定權利

iCloud

iCloud 權利可讓您的應用程式將資料儲存在雲端,讓使用者可以在多個裝置之間共用其數據。

權利是使用 com.apple.developer.icloud-container-development-container-identifiers 的索引鍵,類型ArrayString為 ,然後定義代表容器識別碼的其他密鑰:

<key>com.apple.developer.icloud-container-identifiers</key>
<array>
  <string>iCloud.com.companyname.test</string>
</array>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>

$(AppIdentifierPrefix)$(CFBundleIdentifier) 佔位元將在建置階段取代正確的值。

如需詳細資訊,請參閱 developer.apple.com 上的 iCloud 容器標識符權利

增加記憶體限制

增加的記憶體限制權利可讓您的應用程式超過支援裝置上的預設應用程式記憶體限制。

權利是使用 com.apple.developer.kernel.increased-memory-limit 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.kernel.increased-memory-limit</key>
<true/>

如需詳細資訊,請參閱 增加 developer.apple.com 的記憶體限制權利

應用程式間音訊

應用程式間音訊權利可讓應用程式傳送和接收已啟用應用程式間音訊的其他應用程式來回傳送和接收音訊。

權利是使用 inter-app-audio 類型的 Boolean索引鍵來定義:

<key>inter-app-audio</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的應用程式間音訊權利

重要

此權利在 iOS 13 中已被取代,而且在 macOS 中執行 iPad 應用程式時無法使用。

金鑰鏈

Keychain 權利可讓相同小組撰寫的多個應用程式共享密碼。

權利是使用 keychain-access-groupsArrayString別的索引鍵來定義:

<key>keychain-access-groups</key>
<array>
  <string>$(AppIdentifierPrefix)com.companyname.test</string>
</array>

如需詳細資訊,請參閱 developer.apple.com 上的 Keychain 存取群組權利

MDM 受控相關聯網域

行動開發管理 (MDM) 受控相關聯網域權利可讓 MDM 以應用程式隨附的值來補充相關聯的網域,例如環境唯一的伺服器名稱。

權利是使用 com.apple.developer.associated-domains.mdm-managed 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.associated-domains.mdm-managed</key>
<true/>

多重路徑

Multipath 權利可讓您的應用程式使用多重路徑通訊協定,例如 Multipath TCP,這會順暢地將流量從一個介面交接到另一個介面。

權利是使用 com.apple.developer.networking.multipath 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.networking.multipath</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的多重路徑權利

近距離欄位通訊標記讀取器

近距離通信標記讀取者權利可讓應用程式讀取 NFC 資料交換格式 (NDEF) 近場通信 (NFC) 標記。

權利是使用 com.apple.developer.nfc.readersession.formatsArrayString別的索引鍵來定義:

<key>com.apple.developer.nfc.readersession.formats</key>
<array>
  <string>NDEF</string>
  <string>TAG</string>
</array>

如需詳細資訊,請參閱 developer.apple.com 上的近場通訊標記讀取器會話格式權利

網路擴充功能

網路延伸模組權利可讓您建立應用程式延伸模組,以擴充和自定義裝置的網路功能。

權利是使用 com.apple.developer.networking.networkextensionArrayString別的索引鍵來定義:

<key>com.apple.developer.networking.networkextension</key>
<array>
  <string>content-filter-provider</string>
</array>

如需詳細資訊,請參閱 developer.apple.com 上的網路延伸模組權利

個人 VPN

個人 VPN 權利可讓您的應用程式使用自訂 VPN 連線。

權利是使用 com.apple.developer.networking.vpn.apiArrayString別的索引鍵來定義:

<key>com.apple.developer.networking.vpn.api</key>
<array>
  <string>allow-vpn</string>
</array>

如需詳細資訊,請參閱 developer.apple.com 的個人 VPN 權利

推播通知

推播通知權利可讓您的應用程式接收推播通知。

權利是使用 aps-environment 類型的 String索引鍵來定義:

<key>aps-environment</key>
<string>development</string>

如需詳細資訊,請參閱 developer.apple.com 上的 APS 環境權利

推播交談

通話權利推送可讓您的應用程式向系統報告「推送至通話」頻道,以便處理傳輸和接收背景音訊。

權利是使用 com.apple.developer.push-to-talk 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.push-to-talk</key>
<true/>

如需詳細資訊,請參閱 推播至 developer.apple.com 的交談權利

與您共用

與您共用的權利可讓應用程式宣告在訊息交談中共用的連結,並讓這些連結透過「與您共用」架構呈現。

權利是使用 com.apple.developer.shared-with-you 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.shared-with-you</key>
<true/>

使用 Apple 登入

使用 Apple 權利登入可讓使用者使用其 Apple ID 進行驗證。

權利是使用 com.apple.developer.applesigninArrayString別的索引鍵來定義:

<key>com.apple.developer.applesignin</key>
<array>
  <string>Default</string>
</array>

如需詳細資訊,請參閱 在 developer.apple.com 上使用 Apple 權利 登入。

Siri

Siri 權利可讓您的應用程式處理 Siri 要求。

權利是使用 com.apple.developer.siri 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.siri</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的 Siri 權利

時間敏感性通知

時間敏感性通知權利可讓應用程式處理時間敏感性通知。 時間敏感性通知會傳遞需要立即注意的資訊,並直接呼叫個人,以在收到通知的那一刻採取行動。 時間敏感度警示一律會立即傳遞、顯示在其他通知上方,並允許突破焦點和「不要打擾」。

權利是使用 com.apple.developer.usernotifications.time-sensitive 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.usernotifications.time-sensitive</key>
<true/>

電子錢包

錢包權利可讓您的應用程式管理通行證、門票、禮品卡和忠誠度卡。 它支援各種條碼格式。

權利是使用 com.apple.developer.pass-type-identifiersArrayString別的索引鍵來定義:

<key>com.apple.developer.pass-type-identifiers</key>
<array>
  <string>$(TeamIdentifierPrefix)*</string>
</array>

這個範例可讓您的應用程式允許所有傳遞類型。 若要限制您的應用程式,而且只允許一組小組傳遞類型,請將字串值設定為 $(TeamIdentifierPrefix)pass.$(CFBundleIdentifier) 其中 pass.$(CFBundleIdentifier) 是傳遞標識符。

如需詳細資訊,請參閱 傳遞 developer.apple.com 的型別標識符權利

WeatherKit

WeatherKit 權利可讓應用程式接收及處理目前和預測的天氣資訊。

權利是使用 com.apple.developer.weatherkit 類型的 Boolean索引鍵來定義:

<key>com.apple.developer.weatherkit</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的 WeatherKit 權利

無線配件組態

無線配件設定權利可讓您的應用程式設定WiFi配件。

權利是使用 com.apple.external-accessory.wireless-configuration 類型的 Boolean索引鍵來定義:

<key>com.apple.external-accessory.wireless-configuration</key>
<true/>

如需詳細資訊,請參閱 developer.apple.com 上的無線配件設定權利