Crash logs record information about application crashes. You can view crash reports on the Performance Analytics page in the Mobile Analysis Service console.
Log instrumentation is supported for projects that use the mPaaS framework and for native projects.
Based on the mPaaS framework
If your project uses the framework (contains the APMobileFramework library), the crash reporting module automatically catches crash logs and uploads them to the server-side. After integrating the SDK, confirm that crash monitoring is enabled. To ensure that crash logs are reported promptly, enable crash monitoring in the main function.
#import <MPMasAdapter/MPMasAdapter.h>
[MPAnalysisHelper enableCrashReporterService];Based on a native project
If your project does not use the framework (does not contain the APMobileFramework library), you must enable crash monitoring at startup and report crash logs after the application starts.
Enable crash monitoring in the main method.
#import <MPMasAdapter/MPMasAdapter.h> [MPAnalysisHelper enableCrashReporterService];Report crash logs in the
didFinishLaunchingWithOptionsmethod of the startup flow.#import <MPMasAdapter/MPMasAdapter.h> [[MPAnalysisHelper sharedInstance] writeLogForCrashReporter];
Disaster recovery switch
By default, disaster recovery is triggered if four consecutive crashes occur. This process clears the files in the Documents folder to prevent crashes caused by dirty data. In versions 10.1.60 and later, you can manually call the following API to enable or disable disaster recovery.
#import <MPMasAdapter/MPAnalysisHelper.h>
/**
* Enable or disable crash disaster recovery. Enabled by default.
*/
+ (void)enableDisasterRecovery:(BOOL)enable;Notes
Only crash logs from applications running on a real device are caught and uploaded to the log server. To debug crash monitoring, disconnect from Xcode and do not use an emulator.
To ensure that the version in the crash log matches the product version, set the bundle version and product version to the same version number in the project's
info.plistfile.