-ObjC.js_sdk.js file from the framework into the project root directory;QAPMResourceFile.bundle file from the framework into the project root directory.pod 'QAPM',:source => 'https://github.com/TencentCloud/QAPM-iOS-CocoaPods.git'
#import <QAPM/QAPM.h>. If it is a Swift project, import it in the corresponding bridging-header.h.application:didFinishLaunchingWithOptions method of AppDelegate.m:voidloggerFunc(QAPMLoggerLevellevel,const char*log){#ifdefRELEASEif(level<=QAPMLogLevel_Event){///Public release logNSLog(@"%@",[NSStringstringWithUTF8String:log]);}#endif#ifdefGRAYif(level<=QAPMLogLevel_Info){///Grayscale and public release logNSLog(@"%@",[NSStringstringWithUTF8String:log]);}#endif#ifdefDEBUGif(level<=QAPMLogLevel_Debug){///Beta, grayscale and public release logNSLog(@"%@",[NSStringstringWithUTF8String:log]);}#endif}-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions{//In response to the Ministry of Industry and Information Technology's notice on further improving the service capabilities of mobile internet applications, this setting is provided to inform the SDK whether optional personal information collection is allowed, with the default being allowed. Setting it to NO disables collection. This setting must be configured first and has a global effect once set.//Optional personal information includes but is not limited to device manufacturer, system, ISP, etc.//The default setting is YES, meaning collection is allowed. Example code is as follows:[QAPMConfig getInstance].collectOptionalFields = YES;// Special Note: If the above setting is set to NO, some information will no longer be obtained, which may affect frontend search, display, etc., please be informed./// Setting QAPM Log OutputNSLog(@"qapm sdk version : %@", [QAPM sdkVersion]);[QAPM registerLogCallback:loggerFunc];//Report Address//Domestic Site: https://app.rumt-zh.com//International Site: https://app.rumt-sg.com [QAPMConfig getInstance].host = @"https://app.rumt-zh.com";[QAPMConfig getInstance].host = @"https://app.rumt-sg.com";[QAPMConfig getInstance].customerAppVersion = @"Set app custom version number";//Based on the actual situation, set userId and deviceId.//Unique device identifier deviceId, such as IDFV in conjunction with Keychain.[QAPMConfig getInstance].userId = @"Set userId";[QAPMConfig getInstance].deviceID = @"Custom deviceId";/// QAPM Startup[QAPM startWithAppKey:@"Unique product appKey"];return YES;}
QAPMModelStableConfig.h file: - (void)setupModelAll; //This API can enable all monitoring features.QAPMModelStableConfig.h file: - (void)setupModelStable;//This interface can enable all monitoring features except network monitoring and user behavior monitoring. According to the requirements of the Ministry of Industry and Information Technology Document No. 26, network monitoring and user behavior monitoring are classified as extended business features. You can choose whether to activate them based on your needs.enableMonitorTypeOptions in the QAPMConfig.h file, adding multiple parameter enumeration values to activate a series of features. The code is as follows:// Setting the Monitoring Enabled by QAPM:[QAPMConfiggetInstance].enableMonitorTypeOptions=QAPMMonitorTypeBlue|QAPMMonitorTypeCrash|QAPMMonitorTypeHTTPMonitor|QAPMMonitorTypeIUPMonitor|QAPMMonitorTypeLaunch|QAPMMonitorTypeJSError|QAPMMonitorTypeWebViewNetWork|QAPMMonitorTypeWebViewIUPMonitor|QAPMMonitorTypeWebMonitor;
QAPMConfig.h class @property (nonatomic, assign) QAPMMonitorType enableMonitorTypeOptions;QAPMMonitorType is a feature type, with optional values as shown in the following code.///Stalling Detection FeatureQAPMMonitorTypeBlue///Crash Monitoring FeatureQAPMMonitorTypeCrash///Native Network MonitoringQAPMMonitorTypeHTTPMonitor///Native User Behavior MonitoringQAPMMonitorTypeIUPMonitor///Case Monitoring Feature StartupQAPMMonitorTypeLaunch///WebView's JS Exception MonitoringQAPMMonitorTypeJSError///WebView's NetworkQAPMMonitorTypeWebViewNetWork///WebView User Behavior MonitoringQAPMMonitorTypeWebViewIUPMonitor///WebView Page Performance MonitoringQAPMMonitorTypeWebMonitor
QAPMMonitorTypeBlue. QAPMMonitorTypeHTTPMonitor and QAPMMonitorTypeWebViewNetWork parameters in the custom performance module configuration to disable the network monitoring feature. Similarly, you can prevent the entry of QAPMMonitorTypeIUPMonitor and QAPMMonitorTypeWebViewIUPMonitor parameters to disable the user behavior monitoring feature, or simply use the ModelStable feature activation mode to automatically enable other recommended features while all extended business features are disabled.#pragmamark-TableViewDelegate-(void)scrollViewWillBeginDragging:(UIScrollView*)scrollView{[QAPMBlueProfilebeginTrackingWithStage:NSStringFromClass([selfclass])];}-(void)scrollViewDidEndDragging:(UIScrollView*)scrollView willDecelerate:(BOOL)decelerate{if(!decelerate){[QAPMBlueProfilestopTrackingWithStage:NSStringFromClass([selfclass])];}}-(void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView{[QAPMBlueProfilestopTrackingWithStage:NSStringFromClass([selfclass])];}
@interfaceQAPMLaunchProfile:NSObject/**Set a custom tagging interval for begin. This interval must be within the startup time. The scene for begin and end must be consistent.@param scene Scene Name*/-(void)setBeginTimestampForScene:(NSString*)scene;/**Set a custom tagging interval for end. This interval must be within the startup time. The scene for begin and end must be consistent.@param scene Scene Name*/-(void)setEndTimestampForScene:(NSString*)scene;@end
#import <QAPM/QAPMLaunchProfile.h>.intmain(int argc,char*argv[]){@autoreleasepool{[QAPMLaunchProfiledidEnterMain];returnUIApplicationMain(argc,argv,nil,NSStringFromClass([AppDelegateclass]));}}
#import<TMFQWebView/QBWKWebView.h>@interfaceWKWebviewViewController()<WKUIDelegate,WKNavigationDelegate,WKScriptMessageHandler,TMFWebOfflineWebViewControllerProtocol>{TMFWkWebView*wkWebView;}
#import <QAPM/QAPMLaunchProfile.h> in the class file to import the SDK header file. -(void)webView:(WKWebView*)webView didFinishNavigation:(WKNavigation*)navigation{[webView evaluateJavaScript:[QAPMWebViewProfileqapmBaseInfo:@" "]completionHandler:nil];[webView evaluateJavaScript:[QAPMWebViewProfileqapmJsStart]completionHandler:nil];}
// QAPM can only be initialized normally after the user has granted authorizationif(isAgree){}//The first tagging for the startup duration function// Requires passing in a unique device identifier, such as IDFV in conjunction with Keychain.[QAPMConfiggetInstance].deviceID=@"Custom deviceId";//User ID or third-party log-in account. This API can be used multiple times in the code[QAPMConfiggetInstance].userId=@"Set userId";



[QAPM startWithAppKey:], set the log output function to control the log output according to different release versions:voidloggerFunc(QAPMLoggerLevellevel,const char*log){#ifdefRELEASEif(level<=QAPMLogLevel_Event){///Public release logNSLog(@"%@",[NSStringstringWithUTF8String:log]);}#endif#ifdefGRAYif(level<=QAPMLogLevel_Info){///Grayscale and public release logNSLog(@"%@",[NSStringstringWithUTF8String:log]);}#endif#ifdefDEBUGif(level<=QAPMLogLevel_Debug){///Beta, grayscale and public release logNSLog(@"%@",[NSStringstringWithUTF8String:log]);}#endif}-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions{/// Setting QAPM Log Output[QAPMregisterLogCallback:loggerFunc];/// .../// Setting the QAPM SDK Startup}









Feedback