首页指南参考教程

iOS 功能

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


当你对 iOS 权利进行更改时,需要在进行生产构建之前在 Apple 服务器上远程更新此更改。当你运行 eas build 时,EAS Build 会自动将 Apple 开发者控制台上的功能与你的本地权利配置同步。功能是 Apple 提供的 Web 服务,可以将其视为 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 禁用此功能

¥This feature can be disabled with 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 Build 将跳过它。

¥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 稍后推销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 EventService(开发)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
用于开发的驱动程序套件com.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
HealthKitcom.apple.developer.healthkit
HomeKitcom.apple.developer.homekit
热点com.apple.developer.networking.HotspotConfiguration
增加内存限制com.apple.developer.kernel.increased-memory-limit
应用间音频inter-app-audio
低延迟 HLScom.apple.developer.coremedia.hls.low-latency
MDM 管理的关联域com.apple.developer.associated-domains.mdm-managed
地图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
能够按需安装 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 上出示 ID(仅显示)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 预建 的项目,这是首选方法,用于持续生成原生 android 和 ios 目录。

¥Preferred method for projects that do not use Expo Prebuild to continuously generate the native android and ios directories.

  1. 使用 xed ios 打开 Xcode 中的 ios 目录。如果你没有 ios 目录,请运行 npx expo prebuild -p ios 来生成一个。

    ¥Open the ios directory in Xcode with xed ios. If you don't have an ios directory, run npx expo prebuild -p ios to generate one.

  2. 然后按照 添加一个能力 中提到的步骤进行操作。

    ¥Then follow the steps mentioned in Add a capability.

苹果开发者控制台

¥Apple Developer Console

第一步是将相应的键/值对添加到你的 ios/[app]/[app].entitlements (或多目标应用的更具体的权利文件)。你可以参考 支持的功能 来确定应添加哪些权利密钥。

¥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 和档案",然后导航至 "身份标识" 页面。

    ¥Log into Apple Developer Console. Click on "Certificates, IDs & Profiles", then navigate to "Identifiers" page.

  2. 选择与你的应用的打包包标识符匹配的打包包标识符。

    ¥Choose the bundle identifier that matches your app's bundle identifier.

  3. 向下滚动并启用一项功能,某些功能可能需要额外的设置。

    ¥Scroll down and enable a capability, some capabilities may require extra setup.

  4. 滚动到顶部并按 "保存"。你将看到一个对话框,显示 "修改应用功能",按 "确认" 继续。你需要重新生成任何使用此打包包标识符的配置文件,然后它们才能有效构建代码签名的生产 .ipa。

    ¥Scroll to the top and press "Save". You will see a dialog that says "Modify App Capabilities", press "Confirm" to continue. You will need to regenerate any provisioning profiles that use this bundle identifier before they'll be valid for building a code signed production .ipa.

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

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

Expo 中文网 - 粤ICP备13048890号