iOS 功能

了解 EAS Build 中支持的内置 iOS 功能以及如何启用或禁用它们。


当你对 iOS 权限进行更改时,必须先在 Apple 的服务器上远程更新此更改,然后才能进行生产构建。EAS Build 会在你运行 eas build 时自动将 Apple 开发者控制台上的功能与本地权限配置同步。功能是 Apple 提供的网络服务,可以把它们想象成类似 AWS 或 Firebase 的服务。

🌐 When you make a change to your iOS entitlements, this change needs to be updated remotely on Apple's servers before making a production build. EAS Build automatically synchronizes capabilities on the Apple Developer Console with your local entitlements configuration when you run eas build. Capabilities are web services provided by Apple, think of them like AWS or Firebase services.

此功能可以通过 EXPO_NO_CAPABILITY_SYNC=1 eas build 关闭

权利

🌐 Entitlements

在 Expo 应用中,权限是从内省的应用配置中读取的。要编辑它们,请参阅应用配置文件中的 ios.entitlements 字段。你可以通过在项目中运行 npx expo config --type introspect 来查看内省配置,然后查找 ios.entitlements 对象以获取结果。

🌐 In an Expo app, the entitlements are read from the introspected app config. To edit them, see the ios.entitlements field in your app config file. You can see your introspected config by running npx expo config --type introspect in your project and then look for the ios.entitlements object for the results.

在一个裸的 React Native 应用中,权限是从 ios/**/*.entitlements 文件中读取的。

🌐 In a bare React Native app, the entitlements are read from your ios/**/*.entitlements file.

启用

🌐 Enabling

如果在权限文件中存在受支持的权限,那么运行 eas build 会在 Apple 开发者控制台上启用它。如果该功能已经启用,EAS 构建将会跳过它。

🌐 If a supported entitlement is present in the entitlements file, then running eas build will enable it on Apple Developer Console. If the capability is already enabled, then EAS Build will skip it.

禁用

🌐 Disabling

如果某个功能在远程为你的应用启用,但本地权限文件中不存在,那么运行 eas build 会自动将其禁用。

🌐 If a capability is enabled for your app remotely, but not present in the native entitlements file, then running eas build will automatically disable it.

支持的功能

🌐 Supported capabilities

EAS Build 只会启用其内置支持的功能,任何不受支持的权限都必须通过 苹果开发者控制台 手动启用。

🌐 EAS Build will only enable capabilities that it has built-in support for, any unsupported entitlements must be manually enabled via Apple Developer Console.

SupportCapabilityEntitlement string
Access Wi-Fi Informationcom.apple.developer.networking.wifi-info
App Attestcom.apple.developer.devicecheck.appattest-environment
App Groupscom.apple.security.application-groups
Apple Pay Later Merchandisingcom.apple.developer.pay-later-merchandising
Apple Pay Payment Processingcom.apple.developer.in-app-payments
Associated Domainscom.apple.developer.associated-domains
AutoFill Credential Providercom.apple.developer.authentication-services.autofill-credential-provider
ClassKitcom.apple.developer.ClassKit-environment
Communicates with Driverscom.apple.developer.driverkit.communicates-with-drivers
Communication Notificationscom.apple.developer.usernotifications.communication
Custom Network Protocolcom.apple.developer.networking.custom-protocol
Data Protectioncom.apple.developer.default-data-protection
DriverKit Allow Third Party UserClientscom.apple.developer.driverkit.allow-third-party-userclients
DriverKit Family Audio (development)com.apple.developer.driverkit.family.audio
DriverKit Family HID Device (development)com.apple.developer.driverkit.family.hid.device
DriverKit Family HID EventService (development)com.apple.developer.driverkit.family.hid.eventservice
DriverKit Family Networking (development)com.apple.developer.driverkit.family.networking
DriverKit Family SCSIController (development)com.apple.developer.driverkit.family.scsicontroller
DriverKit Family Serial (development)com.apple.developer.driverkit.family.serial
DriverKit Transport HID (development)com.apple.developer.driverkit.transport.hid
DriverKit USB Transport (development)com.apple.developer.driverkit.transport.usb
DriverKit for Developmentcom.apple.developer.driverkit
Extended Virtual Address Spacecom.apple.developer.kernel.extended-virtual-addressing
Family Controlscom.apple.developer.family-controls
FileProvider TestingModecom.apple.developer.fileprovider.testing-mode
Fontscom.apple.developer.user-fonts
Group Activitiescom.apple.developer.group-session
HealthKitcom.apple.developer.healthkit
HomeKitcom.apple.developer.homekit
Hotspotcom.apple.developer.networking.HotspotConfiguration
Increased Memory Limitcom.apple.developer.kernel.increased-memory-limit
Inter-App Audiointer-app-audio
Journaling Suggestionscom.apple.developer.journal.allow
Low Latency HLScom.apple.developer.low-latency-streaming
MDM Managed Associated Domainscom.apple.developer.associated-domains.mdm-managed
Managed App Installation UIcom.apple.developer.managed-app-distribution.install-ui
Mapscom.apple.developer.maps
Matter Allow Setup Payloadcom.apple.developer.matter.allow-setup-payload
Media Device Discoverycom.apple.developer.media-device-discovery-extension
Messages Collaborationcom.apple.developer.shared-with-you.collaboration
Multipathcom.apple.developer.networking.multipath
NFC Tag Readingcom.apple.developer.nfc.readersession.formats
Network Extensionscom.apple.developer.networking.networkextension
5G Network Slicingcom.apple.developer.networking.slicing.appcategory or com.apple.developer.networking.slicing.trafficcategory
On Demand Install Capable for App Clip Extensionscom.apple.developer.on-demand-install-capable
Personal VPNcom.apple.developer.networking.vpn.api
Push Notificationsaps-environment
Push to Talkcom.apple.developer.push-to-talk
Recalibrate Estimatescom.apple.developer.healthkit.recalibrate-estimates
Sensitive Content Analysiscom.apple.developer.sensitivecontentanalysis.client
Shallow Depth and Pressurecom.apple.developer.submerged-shallow-depth-and-pressure
Shared with Youcom.apple.developer.shared-with-you
Sign In with Applecom.apple.developer.applesignin
SiriKitcom.apple.developer.siri
System Extensioncom.apple.developer.system-extension.install
Tap to Pay on iPhonecom.apple.developer.proximity-reader.payment.acceptance
Tap to Present ID on iPhone (Display Only)com.apple.developer.proximity-reader.identity.display
TV Servicescom.apple.developer.user-management
Time Sensitive Notificationscom.apple.developer.usernotifications.time-sensitive
Walletcom.apple.developer.pass-type-identifiers
WeatherKitcom.apple.developer.weatherkit
Wireless Accessory Configurationcom.apple.external-accessory.wireless-configuration
iCloudcom.apple.developer.icloud-container-identifiers
HLS Interstitial PreviewsUnknown

不受支持的功能要么不支持 iOS,要么没有相应的权限值。以下是所有官方 Apple 功能的列表。

🌐 The unsupported capabilities either don't support iOS, or they don't have a corresponding entitlement value. Here is a list of all of the official Apple capabilities.

能力标识符

🌐 Capability identifiers

商户 ID、应用组和 CloudKit 容器都可以自动注册并分配给你的应用。这些分配需要 Apple cookie 认证(在本地运行),因为官方的 App Store Connect API 不支持这些操作。

🌐 Merchant IDs, App Groups, and CloudKit Containers can all be automatically registered and assigned to your app. These assignments require Apple cookies authentication (running locally) as the official App Store Connect API does not support these operations.

调试 iOS 功能

🌐 Debugging iOS capabilities

你可以运行 EXPO_DEBUG=1 eas build 来获取关于能力同步的更详细日志。

🌐 You can run EXPO_DEBUG=1 eas build to get more detailed logs regarding the capability syncing.

如果你在使用此功能时遇到困难,可以通过环境变量 EXPO_NO_CAPABILITY_SYNC=1 将其禁用。

🌐 If you have trouble using this feature, you can disable it with the environment variable EXPO_NO_CAPABILITY_SYNC=1.

要查看所有当前启用的功能,请访问 苹果开发者控制台,并找到与你的应用匹配的打包标识符,如果你点击它,你应该会看到所有当前启用功能的列表。

🌐 To see all of the currently enabled capabilities, visit Apple Developer Console, and find the bundle identifier matching your app, if you click on it you should see a list of all the currently enabled capabilities.

手动设置

🌐 Manual setup

有两种方法可以手动启用 Apple 功能,这两种系统都需要重新生成任何现有的 Apple 配置文件。

🌐 There are two ways to manually enable Apple capabilities, both systems will require any existing Apple provisioning profiles to be regenerated.

Xcode

对于使用 Expo Prebuild 持续生成原生 androidios 目录的项目,推荐的方法。

  1. xed ios 在 Xcode 中打开 ios 目录。如果你没有 ios 目录,运行 npx expo prebuild -p ios 来生成一个。
  2. 然后按照添加功能中提到的步骤操作。

苹果开发者控制台

🌐 Apple Developer Console

第一步是在你的 ios/[app]/[app].entitlements(或针对多目标应用的更具体的权限文件)中添加相应的键/值对。你可以参考 Supported Capabilities 来确定应该添加哪些权限键。

🌐 First step is to add the respective key/value pairs to your ios/[app]/[app].entitlements (or more specific entitlements file for multi-target apps). You can refer to Supported Capabilities to determine which entitlements keys should be added.

  1. 登录 苹果开发者控制台。点击“证书、ID 与配置文件”,然后导航到“标识符”页面。
  2. 选择与你的应用的打包包标识符匹配的打包包标识符。
  3. 向下滚动并启用一项功能,某些功能可能需要额外的设置。
  4. 向上滚动到顶部并点击“保存”。你将看到一个显示“修改应用功能”的对话框,点击“确认”以继续。在使用此打包标识符的任何配置文件在生成签名生产 .ipa 之前,你需要重新生成这些配置文件才能使其有效。

如果添加功能过程未正确完成,那么你的 iOS 原生构建将失败,并显示类似以下内容的错误:

🌐 If adding capabilities process has not been done correctly then your iOS native build will fail with an error similar to:

❌ error: Provisioning profile "*[expo] app.bacon.hello AppStore ..." doesn't support the Associated Domains capability. ❌ error: Provisioning profile "*[expo] app.bacon.hello AppStore ..." doesn't include the com.apple.developer.associated-domains entitlement.