React Native的TalkingData插件
npm install react-native-talkingdata --save
rnpm link
在工程target的Build Phases->Link Binary with Libraries
中加入、CoreTelephony.framework、AdSupport.framework、SystemConfiguration.framework、Security.framework、CoreMotion.framework、liz.tbd
在你工程的AppDelegate.m
文件中添加如下代码:
#import "RCTTalkingData.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// 添加在第一行
[RCTTalkingData registerApp:@"APPID" channelID:@"渠道号" crashReport:YES];
...
...
}
在android/app/build.gradle
里,defaultConfig栏目下添加如下代码:
manifestPlaceholders = [
TD_APPID: "talkingdata的APPID",//在此修改微信APPID
APP_CHANNEL: "渠道号",
]
在你自定义的MainActivity的onCreate()中第一行加入
TalkingDataModule.register(getApplicationContext(), null, null, true);
import * as TD from 'react-native-talkingdata';