Introduction
Welcome to the documentation for the JJException framework. This framework provides a convenient way to handle and manage exceptions in your iOS projects. It helps you capture, log, and handle exceptions effectively, allowing for smoother error resolution.
Installation
- Install the framework using CocoaPods by adding the following line to your Podfile:
pod 'JJException'
- Run
pod install
command in your terminal. - Import the framework into your project:
#import <JJException/JJException.h>
Usage
Configuration
Before using JJException, you need to configure the desired exception handling options.
- Define the desired options using the
JJExceptionOption
enum:
typedef NS_OPTIONS(NSUInteger, JJExceptionOption) {
JJExceptionOptionUncaughtException = 1 << 0,
JJExceptionOptionSignalException = 1 << 1,
JJExceptionOptionAllExceptions = NSUIntegerMax
};
- Configure the options using the
setEnabled:withOptions:
method:
[JJException setEnabled:YES withOptions:JJExceptionOptionAllExceptions];
Customization
If you want to customize the exception handling behavior, there are several options available:
- You can selectively enable or disable specific exception types:
[JJException registerExceptionCategory:JJExceptionGuardAll];
- You can add custom actions to be triggered before or after an exception:
[JJException setBeforeExceptionAction:^(NSException *exception) {
// Custom code to execute before the exception handling
}];
[JJException setAfterExceptionAction:^(NSException *exception) {
// Custom code to execute after the exception handling
}];
Logging
JJException provides a built-in logging mechanism that helps in tracking and analyzing exceptions.
- Enable or disable logging using the
setLogEnable:
method:
[JJException setLogEnable:YES];
- Set the log file path using the
setLogFileAddress:
method:
[JJException setLogFileAddress:@"your/log/file/path.log"];
Conclusion
That's all you need to know to get started with JJException. With its powerful exception handling capabilities and customizable options, you'll be able to effectively manage exceptions in your iOS projects. Happy coding!