在项目工程的Podfile文件中添加:
pod 'tingyunApp'
在项目工程的Cartfile文件中添加:
github "TingYunAPM/TingYunApp"
#import <tingyunApp/NBSAppAgent.h>
Swift工程在桥街头文件中引入:
#ifndef testswift__Bridging_Header_h
#define testswift__Bridging_Header_h
#import <tingyunApp/NBSAppAgent.h>
#endif /* testswift__Bridging_Header_h */
在嵌码项目工程main.m的main方法中添加初始化;也可以在AppDelegate.m的application:didFinishLaunchingWithOptions:(该方法中初始化会采集不到App启动时间)方法中初始化。
int main(int argc, char * argv[]) {
@autoreleasepool {
[NBSAppAgent startWithAppID:@"YOUR_APPKEY" location:YES];
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
Swift工程请在AppDelegate.swift文件的application(_:didFinishLaunchingWithOptions:)方法中初始化:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
NBSAppAgent.start(withAppID: "Your_appkey", location: true)
return true
}
登录控制台,进入APP概览页 –> 点击小齿轮 –> 点击修改设置,进入到修改设置详情页面,URL Scheme就在appkey下面,格式为:tingyun.appid。
将获取到的URL Scheme添加到target –> info –> URL Types 。
NBSAppAgent SDK_Version
---->start!
Success to connect to NBSSERVER