@adobe/react-native-acpcore

中文文档
2.0.2发布于 2022/07/26Apache-2.0CommonJS零依赖近 30 天下载 3083

Adobe体验平台支持回放原生应用程序.

此软件包已被标记为弃用

Package no longer supported (underlying SDK deprecated)

中文使用文档
文档目录16 节
  1. 目录
  2. 所需资源
  3. 安装
  4. 1. 创建反应土著项目
  5. 2. 安装 JavaScript 软件包
  6. 3. 配置本地项目
  7. 测试
  8. 使用量
  9. 初始化 :
  10. 核心
  11. 身份
  12. 生命周期
  13. 信号
  14. 解决问题
  15. 捐款
  16. 许可证

反应原生 AEP 核心扩展

npm version npm downloads CircleCI license

@adobe/react-native-acpcore iOS、tvOS和Android周围的包装器 AEP 核心SDK 允许与 React Industrial 应用程序融合。 启用Core扩展的功能完全通过下面所记录的JavaScript提供.

目录

所需资源

  • @adobe/react-native-acpcore 1.x 需求 React Native 0.44.+
  • @adobe/react-native-acpcore 2.x 需求 React Native 0.60.+

安装

你需要安装 SDK 与 无 并配置本地的Android/iOS项目.

注意:如果你是新来的,我们建议你遵循 启动原生状态 继续前页.

1. 创建反应土著项目

首先创建 React 本地项目 :

react-native init MyReactApp

注:随行 反应原生 tvos 支持 用 tvos 目标创建应用程序.

2. 安装 JavaScript 软件包

安装和链接 @adobe/react-native-acpcore 软件包 :

cd MyReactApp
npm install @adobe/react-native-acpcore
  • 反应原生0.60+

CLI 自动链接功能 在构建应用程序时链接模块.

  • 原生反应 0.59
react-native link @adobe/react-native-acpcore

注:如果使用Cocoapods,则运行:

cd ios/ && pod install

3. 配置本地项目

3.1 iOS项目

(仅需 原生反应 0.59(中文(简体) )

在Link Binary With Library部分中,单击+链接并添加以下框架和库:

  • UIKit.framework
  • SystemConfiguration.framework
  • WebKit.framework
  • UserNotifications.framework
  • libsqlite3.0.tbd
  • libc++.tbd
  • libz.tbd

4. 今后的步骤

在您安装了 Core后,您可以安装额外的 AEP React 原生扩展.

延长npm 软件包
分析npm version
观众npm version
运动npm version
媒体npm version
目标npm version
用户配置npm version

测试

这个项目包含在《公约》第2条(a)项中包含的笑话单元测试 __tests__ 目录,用于在本地运行测试 :

make run-tests-locally

使用量

初始化 :

初始化 SDK 应在本地代码中完成, 有关如何初始化 SDK 的文件可以找到 这里。链接的文档初始化了不需要的用户配置扩展名,但是,如果您对用户配置扩展名有兴趣,可以找到它 这里。 。 。 .

一旦您在应用程序中添加了初始化代码, 请在启动 SDK 之前将 SDK 包装器类型设置为 React Native .

iOS: (英语)
[ACPCore setWrapperType:ACPMobileWrapperTypeReactNative];
机器人:
MobileCore.setWrapperType(WrapperType.REACT_NATIVE);

核心

更新 SDK 配置 :
ACPCore.updateConfiguration({"yourConfigKey": "yourConfigValue"});
获取 SDK 版本 :
ACPCore.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPCore version: " + version));
获取日志级别 :
ACPCore.getLogLevel().then(level => console.log("AdobeExperienceSDK: Log Level = " + level));
控制 SDK 的日志级别 :
import {ACPMobileLogLevel} from '@adobe/react-native-acpcore';

ACPCore.setLogLevel(ACPMobileLogLevel.VERBOSE);
使用 AEP 日志 API :
import {ACPMobileLogLevel} from '@adobe/react-native-acpcore';

ACPCore.log(ACPMobileLogLevel.ERROR, "React Native Tag", "React Native Message");

说明: ACPMobileLogLevel 包含以下获取器 :

const ERROR = "ACP_LOG_LEVEL_ERROR";
const WARNING = "ACP_LOG_LEVEL_WARNING";
const DEBUG = "ACP_LOG_LEVEL_DEBUG";
const VERBOSE = "ACP_LOG_LEVEL_VERBOSE";
获取当前隐私状态 :
ACPCore.getPrivacyStatus().then(status => console.log("AdobeExperienceSDK: Privacy Status = " + status));
设置隐私状态 :
import {ACPMobilePrivacyStatus} from '@adobe/react-native-acpcore';

ACPCore.setPrivacyStatus(ACPMobilePrivacyStatus.OPT_IN);

说明: ACPMobilePrivacyStatus 包含以下获取器 :

const OPT_IN = "ACP_PRIVACY_STATUS_OPT_IN";
const OPT_OUT = "ACP_PRIVACY_STATUS_OPT_OUT";
const UNKNOWN = "ACP_PRIVACY_STATUS_UNKNOWN";
获取 SDK 身份 :
ACPCore.getSdkIdentities().then(identities => console.log("AdobeExperienceSDK: Identities = " + identities));
调度活动中心活动:
import {ACPExtensionEvent} from '@adobe/react-native-acpcore';

var event = new ACPExtensionEvent("eventName", "eventType", "eventSource", {"testDataKey": "testDataValue"});
ACPCore.dispatchEvent(event);
以召回方式发出事件中心活动:
import {ACPExtensionEvent} from '@adobe/react-native-acpcore';

var event = new ACPExtensionEvent("eventName", "eventType", "eventSource", {"testDataKey": "testDataValue"});
ACPCore.dispatchEventWithResponseCallback(event).then(responseEvent => console.log("AdobeExperienceSDK: responseEvent = " + responseEvent));
发出事件中心响应活动:
import {ACPExtensionEvent} from '@adobe/react-native-acpcore';

var responseEvent = new ACPExtensionEvent("responseEvent", "eventType", "eventSource", {"testDataKey": "testDataValue"});
var requestEvent = new ACPExtensionEvent("requestEvent", "eventType", "eventSource", {"testDataKey": "testDataValue"});
ACPCore.dispatchResponseEvent(responseEvent, requestEvent);

身份

获取扩展版本 :
ACPIdentity.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPIdentity version: " + version));
同步标识符 :
ACPIdentity.syncIdentifier("identifierType", "identifier", ACPMobileVisitorAuthenticationState.AUTHENTICATED);
同步标识符 :
ACPIdentity.syncIdentifiers({"id1": "identifier1"});
与认证状态同步标识符 :
import {ACPMobileVisitorAuthenticationState} from '@adobe/react-native-acpcore';

ACPIdentity.syncIdentifiersWithAuthState({"id1": "identifier1"}, ACPMobileVisitorAuthenticationState.UNKNOWN);

说明: ACPMobileVisitorAuthenticationState 包含以下获取器 :

const AUTHENTICATED = "ACP_VISITOR_AUTH_STATE_AUTHENTICATED";
const LOGGED_OUT = "ACP_VISITOR_AUTH_STATE_LOGGED_OUT";
const UNKNOWN = "ACP_VISITOR_AUTH_STATE_UNKNOWN";
设置广告标识符 :
ACPCore.setAdvertisingIdentifier("adID");
将访问者数据添加到 URL :
ACPIdentity.appendVisitorInfoForURL("test.com").then(urlWithVisitorData => console.log("AdobeExperienceSDK: VisitorData = " + urlWithVisitorData));
获取访问者数据为 URL 查询参数字符串 :
ACPIdentity.getUrlVariables().then(urlVariables => console.log("AdobeExperienceSDK: UrlVariables = " + urlVariables));
获取标识符 :
ACPIdentity.getIdentifiers().then(identifiers => console.log("AdobeExperienceSDK: Identifiers = " + identifiers));
获取经验云ID:
ACPIdentity.getExperienceCloudId().then(cloudId => console.log("AdobeExperienceSDK: CloudID = " + cloudId));
设置驱动标识符 :
ACPCore.setPushIdentifier("pushIdentifier");
访问类 :
import {ACPVisitorID} from '@adobe/react-native-acpcore';

var visitorId = new ACPVisitorID(idOrigin?: string, idType: string, id?: string, authenticationState?: ACPMobileVisitorAuthenticationState)

生命周期

注:通过Javascript实施生命周期可能导致生命周期计量不准确,因此我们建议在本地实施生命周期 Android 和 iOS 代码。 。 。 .

获取扩展版本 :
ACPLifecycle.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPLifecycle version: " + version));

信号

获取扩展版本 :
ACPSignal.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPSignal version: " + version));
收集PII:
ACPCore.collectPii({"myPii": "data"});

解决问题

  1. 不运行可能造成一些不同的错误 react-native link @adobe/react-native-acpcore 或当 React Introduct 0.60.x 中的自动链接器在构建时没有正确链接 SDK 时.
  • TypeError: null is not an object (evaluating RCTACPCore...)

  • ACPCore.h 导入时未找到 <RCTACPCore/ACPCore.h>

  • 在 Javascript 中执行后, 没有 SDK 日志或出错

react-native link @adobe/react-native-acpcore
cd ios/ && pod install # only if using pods

另一个可能的问题是,您的应用程序是使用 Expo不幸的是 Expo 不支持框外的本地模块。 请看 退出到 ExpoKit 中。 。 。 .

  1. Specs satisfying the RCTACPCore (from ../node_modules/@adobe/react-native-acpcore) dependency were found, but they required a higher minimum deployment target.
  • AEP SDK要求至少iOS 10.0正常运行. 如果您看到此错误, 请确保 Podfile 物种至少为iOS 10.0.

捐款

见 捐款

许可证

见 自由主义

版本与发布记录

@adobe/react-native-acpcore 共发布 84 个版本,首次发布于 2019/04/03;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.0.2latest2022/07/264 年前
2.0.12022/04/294 年前
2.0.02021/08/045 年前
2.0.0-alpha.12021/08/035 年前
1.5.12021/04/155 年前
1.5.02020/12/225 年前

关于 @adobe/react-native-acpcore 的常见问题

@adobe/react-native-acpcore 是什么?

Adobe体验平台支持回放原生应用程序.注意:该包已被作者标记为弃用——Package no longer supported (underlying SDK deprecated)

如何安装 @adobe/react-native-acpcore?

在项目目录运行 npm install @adobe/react-native-acpcore,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react-native(>=0.60.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@adobe/react-native-acpcore 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/adobe__react-native-acpcore 是否存在。

@adobe/react-native-acpcore 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@adobe/react-native-acpcore 可以商用吗?

@adobe/react-native-acpcore 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@adobe/react-native-acpcore 的下载量有多少?

根据 npm 官方下载统计,@adobe/react-native-acpcore 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,083 次,日均约 103 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adobe/react-native-acpcore 还在维护吗?

最新版本 2.0.2 发布于 2022/07/26(4 年前);至今共发布 84 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/04/03。作者已将其标记为弃用,新项目建议寻找替代方案。