iOS 功能

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


For the complete documentation index, see llms.txt. Use this file to discover all available pages.

当你对 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.

支持能力权利字符串
访问 Wi-Fi 信息com.apple.developer.networking.wifi-info
应用验证com.apple.developer.devicecheck.appattest-environment
应用组com.apple.security.application-groups
Apple Pay Later 推广com.apple.developer.pay-later-merchandising
Apple Pay 支付处理com.apple.developer.in-app-payments
关联的域com.apple.developer.associated-domains
自动填充凭据提供程序com.apple.developer.authentication-services.autofill-credential-provider
ClassKitcom.apple.developer.ClassKit-environment
与司机沟通com.apple.developer.driverkit.communicates-with-drivers
通讯通知com.apple.developer.usernotifications.communication
自定义网络协议com.apple.developer.networking.custom-protocol
数据保护com.apple.developer.default-data-protection
DriverKit 允许第三方用户客户端com.apple.developer.driverkit.allow-third-party-userclients
DriverKit 家族音频(开发)com.apple.developer.driverkit.family.audio
DriverKit 家族 HID 设备(开发)com.apple.developer.driverkit.family.hid.device
DriverKit 家族 HID 事件服务(开发)com.apple.developer.driverkit.family.hid.eventservice
DriverKit 家族网络 (开发)com.apple.developer.driverkit.family.networking
DriverKit 家族 SCSI 控制器(开发)com.apple.developer.driverkit.family.scsicontroller
DriverKit 系列串行(开发)com.apple.developer.driverkit.family.serial
DriverKit 传输 HID(开发)com.apple.developer.driverkit.transport.hid
DriverKit USB 传输(开发)com.apple.developer.driverkit.transport.usb
用于开发的 DriverKitcom.apple.developer.driverkit
扩展虚拟地址空间com.apple.developer.kernel.extended-virtual-addressing
家庭控制com.apple.developer.family-controls
文件提供者 测试模式com.apple.developer.fileprovider.testing-mode
字体com.apple.developer.user-fonts
团体活动com.apple.developer.group-session
健康套件com.apple.developer.healthkit
HomeKitcom.apple.developer.homekit
热点com.apple.developer.networking.HotspotConfiguration
增加内存限制com.apple.developer.kernel.increased-memory-limit
应用间音频inter-app-audio
日记建议com.apple.developer.journal.allow
低延迟 HLScom.apple.developer.low-latency-streaming
MDM 管理的关联域com.apple.developer.associated-domains.mdm-managed
托管应用安装界面com.apple.developer.managed-app-distribution.install-ui
地图com.apple.developer.maps
物质允许设置有效载荷com.apple.developer.matter.allow-setup-payload
媒体设备发现com.apple.developer.media-device-discovery-extension
消息协作com.apple.developer.shared-with-you.collaboration
多路径com.apple.developer.networking.multipath
NFC 标签读取com.apple.developer.nfc.readersession.formats
网络扩展com.apple.developer.networking.networkextension
5G 网络切片com.apple.developer.networking.slicing.appcategorycom.apple.developer.networking.slicing.trafficcategory
支持按需安装的 App Clip 扩展com.apple.developer.on-demand-install-capable
个人 VPNcom.apple.developer.networking.vpn.api
推送通知aps-environment
按住说话com.apple.developer.push-to-talk
重新校准估算com.apple.developer.healthkit.recalibrate-estimates
敏感内容分析com.apple.developer.sensitivecontentanalysis.client
浅水深度和压力com.apple.developer.submerged-shallow-depth-and-pressure
与你共享com.apple.developer.shared-with-you
使用 Apple 登录com.apple.developer.applesignin
SiriKitcom.apple.developer.siri
系统扩展com.apple.developer.system-extension.install
在 iPhone 上轻触支付com.apple.developer.proximity-reader.payment.acceptance
点击以在 iPhone 上出示身份证(仅显示)com.apple.developer.proximity-reader.identity.display
电视服务com.apple.developer.user-management
时间敏感通知com.apple.developer.usernotifications.time-sensitive
钱包com.apple.developer.pass-type-identifiers
WeatherKitcom.apple.developer.weatherkit
无线访问器配置com.apple.external-accessory.wireless-configuration
iCloudcom.apple.developer.icloud-container-identifiers
HLS 插页预览未知

不受支持的功能要么不支持 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.