This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Expo 联系方式
提供对手机系统联系人的访问的库。
expo-contacts 提供对设备系统联系人访问的功能,允许你获取联系人信息,以及添加、编辑或删除联系人。 在 iOS 上,联系人具有多层分组系统,你也可以通过此 API 访问这些分组。
安装
🌐 Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
应用配置中的配置
🌐 Configuration in app config
如果你在项目中使用配置插件(连续原生生成 (CNG)),可以使用其内置的 配置插件 来配置 expo-contacts。该插件允许你配置无法在运行时设置并且需要构建新的应用二进制文件才能生效的各种属性。如果你的应用不使用 CNG,则需要手动配置该库。
🌐 You can configure expo-contacts using its built-in config plugin if you use config plugins in your project (Continuous Native Generation (CNG)). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. If your app does not use CNG, then you'll need to manually configure the library.
Example app.json with config plugin
Configurable properties
Are you using this library in an existing React Native app?
如果你没有使用连续原生生成(CNG)(而是手动使用原生 Android 和 iOS 项目),那么你需要在原生项目中配置以下权限:
🌐 If you're not using Continuous Native Generation (CNG) (you're using native android and ios projects manually), then you need to configure following permissions in your native projects:
-
对于 Android,在项目的 android/app/src/main/AndroidManifest.xml 中添加
android.permission.READ_CONTACTS和android.permission.WRITE_CONTACTS权限:<uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> -
对于 iOS,在你的项目 ios/[app]/Info.plist 中添加
NSContactsUsageDescription键:<key>NSContactsUsageDescription</key> <string>Allow $(PRODUCT_NAME) to access your contacts</string>
用法
🌐 Usage
应用接口
🌐 API
import { Contact } from 'expo-contacts';
No API data file found, sorry!
权限
🌐 Permissions
安卓
🌐 Android
此库会自动为你的应用添加 READ_CONTACTS 和 WRITE_CONTACTS 权限:
🌐 This library automatically adds READ_CONTACTS and WRITE_CONTACTS permissions to your app:
iOS
该库使用以下用法描述键:
🌐 The following usage description keys are used by this library: