Table of contents Add a Callback for App Crashes (setCrashCallback) Use setCrashCallback (iOS only) to specify a callback function to run when the app crashes. For example, use setCrashCallback to run a callback function which adds an entry to your app's log to save information used when reopening the app. Before You Begin The system requirements of the developer's computer must conform to those of the Aternity iOS Mobile SDK. The Aternity iOS Mobile SDK requires a mobile device with at least iOS 10 or later. Integrate the Aternity iOS Mobile SDK into your app development environment. Include the Aternity.h header file (in Objective-C) into your source code file. To add it to a Swift project, use a bridging header (see Apple's documentation). Initialize the SDK either automatically (by adding Aternity.plist to your project) or manually using activateWithDictionary. Method Definition In iOS, the Aternity class provides a static method called setCrashCallback: + (void)setCrashCallback:(AternityCrashReporterCallback)callback withContext:(void *)context; Field Description callback Specify the name of the callback function to run if the app crashed. This callback function expects three parameters: siginfo_t *info is a pointer to the structure which describes the caught signal. ucontext_t *uap is the context of the thread which crashed before the signal arrived. void *context is the app-specific context. Use this to pass any relevant information if needed. Example //Specify the callback function and parameter to run in the event of an app crash [Aternity setCrashCallback:post_crash_callback withContext:(void *) 0xABABABAB]; //Define the callback function to run in the event of a crash void post_crash_callback (siginfo_t *info, ucontext_t *uap, void *context) { NSLog(@"Detected crash: signo=%d, uap=%p, context=%p", info->si_signo, uap, context); } Parent topic Embed Monitoring in your iOS App with the Aternity iOS SDKRelated tasksIntegrate the Aternity iOS SDK into your App(Troubleshoot Mobile App Crashes with Breadcrumbs)Related referenceInitialize the Aternity iOS Mobile SDK Manually (activateWithDictionary)Set the Username with the Aternity iOS Mobile SDK (userNameStr)Set the Location's Site Name with the Aternity iOS Mobile SDK (setSite and setOffSite)Set the Device Name with the Aternity iOS Mobile SDK (setDeviceName)Tag and Report an Event in an iOS App (tagApplicationWithName, reportTag)Set Contextual Data to Report from an iOS App (setContextValue) SavePDF Selected topic Selected topic and subtopics All content Related Links
Add a Callback for App Crashes (setCrashCallback) Use setCrashCallback (iOS only) to specify a callback function to run when the app crashes. For example, use setCrashCallback to run a callback function which adds an entry to your app's log to save information used when reopening the app. Before You Begin The system requirements of the developer's computer must conform to those of the Aternity iOS Mobile SDK. The Aternity iOS Mobile SDK requires a mobile device with at least iOS 10 or later. Integrate the Aternity iOS Mobile SDK into your app development environment. Include the Aternity.h header file (in Objective-C) into your source code file. To add it to a Swift project, use a bridging header (see Apple's documentation). Initialize the SDK either automatically (by adding Aternity.plist to your project) or manually using activateWithDictionary. Method Definition In iOS, the Aternity class provides a static method called setCrashCallback: + (void)setCrashCallback:(AternityCrashReporterCallback)callback withContext:(void *)context; Field Description callback Specify the name of the callback function to run if the app crashed. This callback function expects three parameters: siginfo_t *info is a pointer to the structure which describes the caught signal. ucontext_t *uap is the context of the thread which crashed before the signal arrived. void *context is the app-specific context. Use this to pass any relevant information if needed. Example //Specify the callback function and parameter to run in the event of an app crash [Aternity setCrashCallback:post_crash_callback withContext:(void *) 0xABABABAB]; //Define the callback function to run in the event of a crash void post_crash_callback (siginfo_t *info, ucontext_t *uap, void *context) { NSLog(@"Detected crash: signo=%d, uap=%p, context=%p", info->si_signo, uap, context); } Parent topic Embed Monitoring in your iOS App with the Aternity iOS SDKRelated tasksIntegrate the Aternity iOS SDK into your App(Troubleshoot Mobile App Crashes with Breadcrumbs)Related referenceInitialize the Aternity iOS Mobile SDK Manually (activateWithDictionary)Set the Username with the Aternity iOS Mobile SDK (userNameStr)Set the Location's Site Name with the Aternity iOS Mobile SDK (setSite and setOffSite)Set the Device Name with the Aternity iOS Mobile SDK (setDeviceName)Tag and Report an Event in an iOS App (tagApplicationWithName, reportTag)Set Contextual Data to Report from an iOS App (setContextValue)
Add a Callback for App Crashes (setCrashCallback) Use setCrashCallback (iOS only) to specify a callback function to run when the app crashes. For example, use setCrashCallback to run a callback function which adds an entry to your app's log to save information used when reopening the app. Before You Begin The system requirements of the developer's computer must conform to those of the Aternity iOS Mobile SDK. The Aternity iOS Mobile SDK requires a mobile device with at least iOS 10 or later. Integrate the Aternity iOS Mobile SDK into your app development environment. Include the Aternity.h header file (in Objective-C) into your source code file. To add it to a Swift project, use a bridging header (see Apple's documentation). Initialize the SDK either automatically (by adding Aternity.plist to your project) or manually using activateWithDictionary. Method Definition In iOS, the Aternity class provides a static method called setCrashCallback: + (void)setCrashCallback:(AternityCrashReporterCallback)callback withContext:(void *)context; Field Description callback Specify the name of the callback function to run if the app crashed. This callback function expects three parameters: siginfo_t *info is a pointer to the structure which describes the caught signal. ucontext_t *uap is the context of the thread which crashed before the signal arrived. void *context is the app-specific context. Use this to pass any relevant information if needed. Example //Specify the callback function and parameter to run in the event of an app crash [Aternity setCrashCallback:post_crash_callback withContext:(void *) 0xABABABAB]; //Define the callback function to run in the event of a crash void post_crash_callback (siginfo_t *info, ucontext_t *uap, void *context) { NSLog(@"Detected crash: signo=%d, uap=%p, context=%p", info->si_signo, uap, context); } Parent topic Embed Monitoring in your iOS App with the Aternity iOS SDKRelated tasksIntegrate the Aternity iOS SDK into your App(Troubleshoot Mobile App Crashes with Breadcrumbs)Related referenceInitialize the Aternity iOS Mobile SDK Manually (activateWithDictionary)Set the Username with the Aternity iOS Mobile SDK (userNameStr)Set the Location's Site Name with the Aternity iOS Mobile SDK (setSite and setOffSite)Set the Device Name with the Aternity iOS Mobile SDK (setDeviceName)Tag and Report an Event in an iOS App (tagApplicationWithName, reportTag)Set Contextual Data to Report from an iOS App (setContextValue)