diff --git a/Sources/KSCrashFilters/KSCrashReportFilterAlert.m b/Sources/KSCrashFilters/KSCrashReportFilterAlert.m index c4859cad..016f1682 100644 --- a/Sources/KSCrashFilters/KSCrashReportFilterAlert.m +++ b/Sources/KSCrashFilters/KSCrashReportFilterAlert.m @@ -61,10 +61,6 @@ - (void)startWithTitle:(NSString *)title @implementation KSCrashAlertViewProcess -@synthesize reports = _reports; -@synthesize onCompletion = _onCompletion; -@synthesize expectedButtonIndex = _expectedButtonIndex; - + (KSCrashAlertViewProcess *)process { return [[self alloc] init]; @@ -78,9 +74,9 @@ - (void)startWithTitle:(NSString *)title onCompletion:(KSCrashReportFilterCompletion)onCompletion { KSLOG_TRACE(@"Starting alert view process"); - self.reports = [reports copy]; - self.onCompletion = onCompletion; - self.expectedButtonIndex = noAnswer == nil ? 0 : 1; + _reports = [reports copy]; + _onCompletion = [onCompletion copy]; + _expectedButtonIndex = noAnswer == nil ? 0 : 1; #if KSCRASH_HAS_UIALERTCONTROLLER UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title @@ -130,20 +126,15 @@ - (void)alertView:(__unused id)alertView clickedButtonAtIndex:(NSInteger)buttonI @interface KSCrashReportFilterAlert () -@property(nonatomic, readwrite, retain) NSString *title; -@property(nonatomic, readwrite, retain) NSString *message; -@property(nonatomic, readwrite, retain) NSString *yesAnswer; -@property(nonatomic, readwrite, retain) NSString *noAnswer; +@property(nonatomic, readwrite, copy) NSString *title; +@property(nonatomic, readwrite, copy) NSString *message; +@property(nonatomic, readwrite, copy) NSString *yesAnswer; +@property(nonatomic, readwrite, copy) NSString *noAnswer; @end @implementation KSCrashReportFilterAlert -@synthesize title = _title; -@synthesize message = _message; -@synthesize yesAnswer = _yesAnswer; -@synthesize noAnswer = _noAnswer; - + (instancetype)filterWithTitle:(NSString *)title message:(nullable NSString *)message yesAnswer:(NSString *)yesAnswer @@ -158,10 +149,10 @@ - (instancetype)initWithTitle:(NSString *)title noAnswer:(nullable NSString *)noAnswer; { if ((self = [super init])) { - self.title = title; - self.message = message; - self.yesAnswer = yesAnswer; - self.noAnswer = noAnswer; + _title = [title copy]; + _message = [message copy]; + _yesAnswer = [yesAnswer copy]; + _noAnswer = [noAnswer copy]; } return self; } diff --git a/Sources/KSCrashFilters/KSCrashReportFilterAppleFmt.m b/Sources/KSCrashFilters/KSCrashReportFilterAppleFmt.m index 71071abb..4590eaa3 100644 --- a/Sources/KSCrashFilters/KSCrashReportFilterAppleFmt.m +++ b/Sources/KSCrashFilters/KSCrashReportFilterAppleFmt.m @@ -130,8 +130,6 @@ - (NSComparisonResult)kscrash_compareRegisterName:(NSString *)other @implementation KSCrashReportFilterAppleFmt -@synthesize reportStyle = _reportStyle; - /** Date formatter for Apple date format in crash reports. */ static NSDateFormatter *g_dateFormatter; @@ -176,7 +174,7 @@ + (instancetype)filterWithReportStyle:(KSAppleReportStyle)reportStyle - (instancetype)initWithReportStyle:(KSAppleReportStyle)reportStyle { if ((self = [super init])) { - self.reportStyle = reportStyle; + _reportStyle = reportStyle; } return self; } diff --git a/Sources/KSCrashFilters/KSCrashReportFilterBasic.m b/Sources/KSCrashFilters/KSCrashReportFilterBasic.m index 5cf4d724..9fb7df8b 100644 --- a/Sources/KSCrashFilters/KSCrashReportFilterBasic.m +++ b/Sources/KSCrashFilters/KSCrashReportFilterBasic.m @@ -49,21 +49,18 @@ - (void)filterReports:(NSArray *)reports onCompletion:(KSCrashR @interface KSCrashReportFilterCombine () -@property(nonatomic, readwrite, retain) NSArray *filters; -@property(nonatomic, readwrite, retain) NSArray *keys; +@property(nonatomic, readwrite, copy) NSArray *filters; +@property(nonatomic, readwrite, copy) NSArray *keys; @end @implementation KSCrashReportFilterCombine -@synthesize filters = _filters; -@synthesize keys = _keys; - - (instancetype)initWithFilters:(NSArray *)filters keys:(NSArray *)keys { if ((self = [super init])) { - self.filters = filters; - self.keys = keys; + _filters = [filters copy]; + _keys = [keys copy]; } return self; } @@ -207,8 +204,6 @@ @interface KSCrashReportFilterPipeline () @implementation KSCrashReportFilterPipeline -@synthesize filters = _filters; - + (instancetype)filterWithFilters:(id)firstFilter, ... { ksva_list_to_nsarray(firstFilter, filters); @@ -303,16 +298,13 @@ - (void)filterReports:(NSArray *)reports onCompletion:(KSCrashR @interface KSCrashReportFilterConcatenate () -@property(nonatomic, readwrite, retain) NSString *separatorFmt; -@property(nonatomic, readwrite, retain) NSArray *keys; +@property(nonatomic, readwrite, copy) NSString *separatorFmt; +@property(nonatomic, readwrite, copy) NSArray *keys; @end @implementation KSCrashReportFilterConcatenate -@synthesize separatorFmt = _separatorFmt; -@synthesize keys = _keys; - + (instancetype)filterWithSeparatorFmt:(NSString *)separatorFmt keys:(id)firstKey, ... { ksva_list_to_nsarray(firstKey, keys); @@ -342,8 +334,8 @@ - (instancetype)initWithSeparatorFmt:(NSString *)separatorFmt keysArray:(NSArray } } - self.separatorFmt = separatorFmt; - self.keys = realKeys; + _separatorFmt = [separatorFmt copy]; + _keys = [realKeys copy]; } return self; } @@ -372,14 +364,12 @@ - (void)filterReports:(NSArray *)reports onCompletion:(KSCrashR @interface KSCrashReportFilterSubset () -@property(nonatomic, readwrite, retain) NSArray *keyPaths; +@property(nonatomic, readwrite, copy) NSArray *keyPaths; @end @implementation KSCrashReportFilterSubset -@synthesize keyPaths = _keyPaths; - + (instancetype)filterWithKeys:(id)firstKeyPath, ... { ksva_list_to_nsarray(firstKeyPath, keyPaths); @@ -409,7 +399,7 @@ - (instancetype)initWithKeysArray:(NSArray *)keyPaths } } - self.keyPaths = realKeyPaths; + _keyPaths = [realKeyPaths copy]; } return self; } diff --git a/Sources/KSCrashFilters/KSCrashReportFilterGZip.m b/Sources/KSCrashFilters/KSCrashReportFilterGZip.m index 7efd792b..e513b059 100644 --- a/Sources/KSCrashFilters/KSCrashReportFilterGZip.m +++ b/Sources/KSCrashFilters/KSCrashReportFilterGZip.m @@ -39,8 +39,6 @@ @interface KSCrashReportFilterGZipCompress () @implementation KSCrashReportFilterGZipCompress -@synthesize compressionLevel = _compressionLevel; - + (instancetype)filterWithCompressionLevel:(NSInteger)compressionLevel { return [[self alloc] initWithCompressionLevel:compressionLevel]; @@ -49,7 +47,7 @@ + (instancetype)filterWithCompressionLevel:(NSInteger)compressionLevel - (instancetype)initWithCompressionLevel:(NSInteger)compressionLevel { if ((self = [super init])) { - self.compressionLevel = compressionLevel; + _compressionLevel = compressionLevel; } return self; } diff --git a/Sources/KSCrashFilters/KSCrashReportFilterJSON.m b/Sources/KSCrashFilters/KSCrashReportFilterJSON.m index e0551cc2..f640cb02 100644 --- a/Sources/KSCrashFilters/KSCrashReportFilterJSON.m +++ b/Sources/KSCrashFilters/KSCrashReportFilterJSON.m @@ -38,8 +38,6 @@ @interface KSCrashReportFilterJSONEncode () @implementation KSCrashReportFilterJSONEncode -@synthesize encodeOptions = _encodeOptions; - + (instancetype)filterWithOptions:(KSJSONEncodeOption)options { return [[self alloc] initWithOptions:options]; @@ -48,7 +46,7 @@ + (instancetype)filterWithOptions:(KSJSONEncodeOption)options - (instancetype)initWithOptions:(KSJSONEncodeOption)options { if ((self = [super init])) { - self.encodeOptions = options; + _encodeOptions = options; } return self; } @@ -86,8 +84,6 @@ @interface KSCrashReportFilterJSONDecode () @implementation KSCrashReportFilterJSONDecode -@synthesize decodeOptions = _encodeOptions; - + (instancetype)filterWithOptions:(KSJSONDecodeOption)options { return [[self alloc] initWithOptions:options]; @@ -96,7 +92,7 @@ + (instancetype)filterWithOptions:(KSJSONDecodeOption)options - (instancetype)initWithOptions:(KSJSONDecodeOption)options { if ((self = [super init])) { - self.decodeOptions = options; + _decodeOptions = options; } return self; } diff --git a/Sources/KSCrashInstallations/KSCrashInstallation.m b/Sources/KSCrashInstallations/KSCrashInstallation.m index 7c5e5b9d..ef6ce0a6 100644 --- a/Sources/KSCrashInstallations/KSCrashInstallation.m +++ b/Sources/KSCrashInstallations/KSCrashInstallation.m @@ -57,24 +57,17 @@ @interface KSCrashInstReportField : NSObject @property(nonatomic, readonly, assign) int index; @property(nonatomic, readonly, assign) ReportField *field; -@property(nonatomic, readwrite, retain) NSString *key; -@property(nonatomic, readwrite, retain) id value; +@property(nonatomic, readwrite, copy) NSString *key; +@property(nonatomic, readwrite, strong) id value; -@property(nonatomic, readwrite, retain) NSMutableData *fieldBacking; -@property(nonatomic, readwrite, retain) KSCString *keyBacking; -@property(nonatomic, readwrite, retain) KSCString *valueBacking; +@property(nonatomic, readwrite, strong) NSMutableData *fieldBacking; +@property(nonatomic, readwrite, strong) KSCString *keyBacking; +@property(nonatomic, readwrite, strong) KSCString *valueBacking; @end @implementation KSCrashInstReportField -@synthesize index = _index; -@synthesize key = _key; -@synthesize value = _value; -@synthesize fieldBacking = _fieldBacking; -@synthesize keyBacking = _keyBacking; -@synthesize valueBacking = _valueBacking; - + (KSCrashInstReportField *)fieldWithIndex:(int)index { return [(KSCrashInstReportField *)[self alloc] initWithIndex:index]; @@ -84,7 +77,7 @@ - (id)initWithIndex:(int)index { if ((self = [super init])) { _index = index; - self.fieldBacking = [NSMutableData dataWithLength:sizeof(*self.field)]; + _fieldBacking = [NSMutableData dataWithLength:sizeof(*self.field)]; } return self; } @@ -132,21 +125,15 @@ @interface KSCrashInstallation () @property(nonatomic, readwrite, assign) int nextFieldIndex; @property(nonatomic, readonly, assign) CrashHandlerData *crashHandlerData; -@property(nonatomic, readwrite, retain) NSMutableData *crashHandlerDataBacking; -@property(nonatomic, readwrite, retain) NSMutableDictionary *fields; -@property(nonatomic, readwrite, retain) NSArray *requiredProperties; -@property(nonatomic, readwrite, retain) KSCrashReportFilterPipeline *prependedFilters; +@property(nonatomic, readwrite, strong) NSMutableData *crashHandlerDataBacking; +@property(nonatomic, readwrite, strong) NSMutableDictionary *fields; +@property(nonatomic, readwrite, copy) NSArray *requiredProperties; +@property(nonatomic, readwrite, strong) KSCrashReportFilterPipeline *prependedFilters; @end @implementation KSCrashInstallation -@synthesize nextFieldIndex = _nextFieldIndex; -@synthesize crashHandlerDataBacking = _crashHandlerDataBacking; -@synthesize fields = _fields; -@synthesize requiredProperties = _requiredProperties; -@synthesize prependedFilters = _prependedFilters; - - (id)init { [NSException raise:NSInternalInconsistencyException @@ -157,12 +144,12 @@ - (id)init - (id)initWithRequiredProperties:(NSArray *)requiredProperties { if ((self = [super init])) { - self.crashHandlerDataBacking = + _crashHandlerDataBacking = [NSMutableData dataWithLength:sizeof(*self.crashHandlerData) + sizeof(*self.crashHandlerData->reportFields) * kMaxProperties]; - self.fields = [NSMutableDictionary dictionary]; - self.requiredProperties = requiredProperties; - self.prependedFilters = [KSCrashReportFilterPipeline filterWithFilters:nil]; + _fields = [NSMutableDictionary dictionary]; + _requiredProperties = [requiredProperties copy]; + _prependedFilters = [KSCrashReportFilterPipeline filterWithFilters:nil]; } return self; } diff --git a/Sources/KSCrashInstallations/KSCrashInstallationConsole.m b/Sources/KSCrashInstallations/KSCrashInstallationConsole.m index 5ed81c22..cafca7e5 100644 --- a/Sources/KSCrashInstallations/KSCrashInstallationConsole.m +++ b/Sources/KSCrashInstallations/KSCrashInstallationConsole.m @@ -33,8 +33,6 @@ @implementation KSCrashInstallationConsole -@synthesize printAppleFormat = _printAppleFormat; - + (instancetype)sharedInstance { static KSCrashInstallationConsole *sharedInstance = nil; @@ -49,7 +47,7 @@ + (instancetype)sharedInstance - (id)init { if ((self = [super initWithRequiredProperties:nil])) { - self.printAppleFormat = NO; + _printAppleFormat = NO; } return self; } diff --git a/Sources/KSCrashInstallations/KSCrashInstallationEmail.m b/Sources/KSCrashInstallations/KSCrashInstallationEmail.m index f8f67107..e5b69b9d 100644 --- a/Sources/KSCrashInstallations/KSCrashInstallationEmail.m +++ b/Sources/KSCrashInstallations/KSCrashInstallationEmail.m @@ -31,19 +31,12 @@ @interface KSCrashInstallationEmail () -@property(nonatomic, readwrite, retain) NSDictionary *defaultFilenameFormats; +@property(nonatomic, readwrite, copy) NSDictionary *defaultFilenameFormats; @end @implementation KSCrashInstallationEmail -@synthesize recipients = _recipients; -@synthesize subject = _subject; -@synthesize message = _message; -@synthesize filenameFmt = _filenameFmt; -@synthesize reportStyle = _reportStyle; -@synthesize defaultFilenameFormats = _defaultFilenameFormats; - + (instancetype)sharedInstance { static KSCrashInstallationEmail *sharedInstance = nil; @@ -60,8 +53,8 @@ - (id)init if ((self = [super initWithRequiredProperties:[NSArray arrayWithObjects:@"recipients", @"subject", @"filenameFmt", nil]])) { NSString *bundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; - self.subject = [NSString stringWithFormat:@"Crash Report (%@)", bundleName]; - self.defaultFilenameFormats = [NSDictionary + _subject = [NSString stringWithFormat:@"Crash Report (%@)", bundleName]; + _defaultFilenameFormats = [NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"crash-report-%@-%%d.txt.gz", bundleName], [NSNumber numberWithInt:KSCrashEmailReportStyleApple], [NSString stringWithFormat:@"crash-report-%@-%%d.json.gz", bundleName], diff --git a/Sources/KSCrashInstallations/KSCrashInstallationStandard.m b/Sources/KSCrashInstallations/KSCrashInstallationStandard.m index 3c08b348..adc879ee 100644 --- a/Sources/KSCrashInstallations/KSCrashInstallationStandard.m +++ b/Sources/KSCrashInstallations/KSCrashInstallationStandard.m @@ -31,8 +31,6 @@ @implementation KSCrashInstallationStandard -@synthesize url = _url; - + (instancetype)sharedInstance { static KSCrashInstallationStandard *sharedInstance = nil; diff --git a/Sources/KSCrashRecording/KSCrash.m b/Sources/KSCrashRecording/KSCrash.m index 42289835..d41d0601 100644 --- a/Sources/KSCrashRecording/KSCrash.m +++ b/Sources/KSCrashRecording/KSCrash.m @@ -54,8 +54,8 @@ @interface KSCrash () -@property(nonatomic, readwrite, retain) NSString *bundleName; -@property(nonatomic, readwrite, retain) NSString *basePath; +@property(nonatomic, readwrite, copy) NSString *bundleName; +@property(nonatomic, readwrite, copy) NSString *basePath; @property(nonatomic, strong) KSCrashConfiguration *configuration; @end @@ -94,16 +94,6 @@ @interface KSCrash () @implementation KSCrash -// ============================================================================ -#pragma mark - Properties - -// ============================================================================ - -@synthesize sink = _sink; -@synthesize bundleName = _bundleName; -@synthesize basePath = _basePath; -@synthesize uncaughtExceptionHandler = _uncaughtExceptionHandler; -@synthesize currentSnapshotUserReportedExceptionHandler = _currentSnapshotUserReportedExceptionHandler; - // ============================================================================ #pragma mark - Lifecycle - // ============================================================================ @@ -145,13 +135,13 @@ + (instancetype)sharedInstance - (instancetype)initWithBasePath:(NSString *)basePath { + if (basePath == nil) { + KSLOG_ERROR(@"Failed to initialize crash handler. Crash reporting disabled."); + return nil; + } if ((self = [super init])) { - self.bundleName = getBundleName(); - self.basePath = basePath; - if (self.basePath == nil) { - KSLOG_ERROR(@"Failed to initialize crash handler. Crash reporting disabled."); - return nil; - } + _bundleName = getBundleName(); + _basePath = [basePath copy]; } return self; } diff --git a/Sources/KSCrashRecording/KSCrashDoctor.m b/Sources/KSCrashRecording/KSCrashDoctor.m index 54e1fcef..d701457f 100644 --- a/Sources/KSCrashRecording/KSCrashDoctor.m +++ b/Sources/KSCrashRecording/KSCrashDoctor.m @@ -14,38 +14,28 @@ @interface KSCrashDoctorParam : NSObject -@property(nonatomic, readwrite, retain) NSString *className; -@property(nonatomic, readwrite, retain) NSString *previousClassName; -@property(nonatomic, readwrite, retain) NSString *type; +@property(nonatomic, readwrite, copy) NSString *className; +@property(nonatomic, readwrite, copy) NSString *previousClassName; +@property(nonatomic, readwrite, copy) NSString *type; @property(nonatomic, readwrite, assign) BOOL isInstance; @property(nonatomic, readwrite, assign) uintptr_t address; -@property(nonatomic, readwrite, retain) NSString *value; +@property(nonatomic, readwrite, copy) NSString *value; @end @implementation KSCrashDoctorParam -@synthesize className = _className; -@synthesize previousClassName = _previousClassName; -@synthesize isInstance = _isInstance; -@synthesize address = _address; -@synthesize value = _value; -@synthesize type = _type; - @end @interface KSCrashDoctorFunctionCall : NSObject -@property(nonatomic, readwrite, retain) NSString *name; -@property(nonatomic, readwrite, retain) NSArray *params; +@property(nonatomic, readwrite, copy) NSString *name; +@property(nonatomic, readwrite, copy) NSArray *params; @end @implementation KSCrashDoctorFunctionCall -@synthesize name = _name; -@synthesize params = _params; - - (NSString *)descriptionForObjCCall { if (![self.name isEqualToString:@"objc_msgSend"]) { diff --git a/Sources/KSCrashRecording/Monitors/KSCrashMonitor_Deadlock.m b/Sources/KSCrashRecording/Monitors/KSCrashMonitor_Deadlock.m index 49008bd1..40e9ce4b 100644 --- a/Sources/KSCrashRecording/Monitors/KSCrashMonitor_Deadlock.m +++ b/Sources/KSCrashRecording/Monitors/KSCrashMonitor_Deadlock.m @@ -62,23 +62,20 @@ @interface KSCrashDeadlockMonitor : NSObject -@property(nonatomic, readwrite, retain) NSThread *monitorThread; +@property(nonatomic, readwrite, strong) NSThread *monitorThread; @property(atomic, readwrite, assign) BOOL awaitingResponse; @end @implementation KSCrashDeadlockMonitor -@synthesize monitorThread = _monitorThread; -@synthesize awaitingResponse = _awaitingResponse; - - (id)init { if ((self = [super init])) { // target (self) is retained until selector (runMonitor) exits. - self.monitorThread = [[NSThread alloc] initWithTarget:self selector:@selector(runMonitor) object:nil]; - self.monitorThread.name = @"KSCrash Deadlock Detection Thread"; - [self.monitorThread start]; + _monitorThread = [[NSThread alloc] initWithTarget:self selector:@selector(runMonitor) object:nil]; + _monitorThread.name = @"KSCrash Deadlock Detection Thread"; + [_monitorThread start]; } return self; } diff --git a/Sources/KSCrashRecordingCore/KSJSONCodecObjC.m b/Sources/KSCrashRecordingCore/KSJSONCodecObjC.m index eaeb0303..f99ccf3a 100644 --- a/Sources/KSCrashRecordingCore/KSJSONCodecObjC.m +++ b/Sources/KSCrashRecordingCore/KSJSONCodecObjC.m @@ -38,19 +38,19 @@ @interface KSJSONCodec () @property(nonatomic, readwrite, assign) KSJSONDecodeCallbacks *callbacks; /** Stack of arrays/objects as the decoded content is built */ -@property(nonatomic, readwrite, retain) NSMutableArray *containerStack; +@property(nonatomic, readwrite, strong) NSMutableArray *containerStack; /** Current array or object being decoded (weak ref) */ @property(nonatomic, readwrite, assign) id currentContainer; /** Top level array or object in the decoded tree */ -@property(nonatomic, readwrite, retain) id topLevelContainer; +@property(nonatomic, readwrite, strong) id topLevelContainer; /** Data that has been serialized into JSON form */ -@property(nonatomic, readwrite, retain) NSMutableData *serializedData; +@property(nonatomic, readwrite, strong) NSMutableData *serializedData; /** Any error that has occurred */ -@property(nonatomic, readwrite, retain) NSError *error; +@property(nonatomic, readwrite, strong) NSError *error; /** If true, pretty print while encoding */ @property(nonatomic, readwrite, assign) bool prettyPrint; @@ -94,19 +94,6 @@ - (id)initWithEncodeOptions:(KSJSONEncodeOption)encodeOptions decodeOptions:(KSJ @implementation KSJSONCodec -#pragma mark Properties - -@synthesize topLevelContainer = _topLevelContainer; -@synthesize currentContainer = _currentContainer; -@synthesize containerStack = _containerStack; -@synthesize callbacks = _callbacks; -@synthesize serializedData = _serializedData; -@synthesize error = _error; -@synthesize prettyPrint = _prettyPrint; -@synthesize sorted = _sorted; -@synthesize ignoreNullsInArrays = _ignoreNullsInArrays; -@synthesize ignoreNullsInObjects = _ignoreNullsInObjects; - #pragma mark Constructors/Destructor + (KSJSONCodec *)codecWithEncodeOptions:(KSJSONEncodeOption)encodeOptions @@ -118,21 +105,21 @@ + (KSJSONCodec *)codecWithEncodeOptions:(KSJSONEncodeOption)encodeOptions - (id)initWithEncodeOptions:(KSJSONEncodeOption)encodeOptions decodeOptions:(KSJSONDecodeOption)decodeOptions { if ((self = [super init])) { - self.containerStack = [NSMutableArray array]; - self.callbacks = malloc(sizeof(*self.callbacks)); - self.callbacks->onBeginArray = onBeginArray; - self.callbacks->onBeginObject = onBeginObject; - self.callbacks->onBooleanElement = onBooleanElement; - self.callbacks->onEndContainer = onEndContainer; - self.callbacks->onEndData = onEndData; - self.callbacks->onFloatingPointElement = onFloatingPointElement; - self.callbacks->onIntegerElement = onIntegerElement; - self.callbacks->onNullElement = onNullElement; - self.callbacks->onStringElement = onStringElement; - self.prettyPrint = (encodeOptions & KSJSONEncodeOptionPretty) != 0; - self.sorted = (encodeOptions & KSJSONEncodeOptionSorted) != 0; - self.ignoreNullsInArrays = (decodeOptions & KSJSONDecodeOptionIgnoreNullInArray) != 0; - self.ignoreNullsInObjects = (decodeOptions & KSJSONDecodeOptionIgnoreNullInObject) != 0; + _containerStack = [NSMutableArray array]; + _callbacks = malloc(sizeof(*self.callbacks)); + _callbacks->onBeginArray = onBeginArray; + _callbacks->onBeginObject = onBeginObject; + _callbacks->onBooleanElement = onBooleanElement; + _callbacks->onEndContainer = onEndContainer; + _callbacks->onEndData = onEndData; + _callbacks->onFloatingPointElement = onFloatingPointElement; + _callbacks->onIntegerElement = onIntegerElement; + _callbacks->onNullElement = onNullElement; + _callbacks->onStringElement = onStringElement; + _prettyPrint = (encodeOptions & KSJSONEncodeOptionPretty) != 0; + _sorted = (encodeOptions & KSJSONEncodeOptionSorted) != 0; + _ignoreNullsInArrays = (decodeOptions & KSJSONDecodeOptionIgnoreNullInArray) != 0; + _ignoreNullsInObjects = (decodeOptions & KSJSONDecodeOptionIgnoreNullInObject) != 0; } return self; } diff --git a/Sources/KSCrashReportingCore/KSCString.m b/Sources/KSCrashReportingCore/KSCString.m index 2c6f09ec..bab4d630 100644 --- a/Sources/KSCrashReportingCore/KSCString.m +++ b/Sources/KSCrashReportingCore/KSCString.m @@ -28,9 +28,6 @@ @implementation KSCString -@synthesize length = _length; -@synthesize bytes = _bytes; - + (KSCString *)stringWithString:(NSString *)string { return [[self alloc] initWithString:string]; diff --git a/Sources/KSCrashReportingCore/KSHTTPMultipartPostBody.m b/Sources/KSCrashReportingCore/KSHTTPMultipartPostBody.m index 31a3a381..e036541c 100644 --- a/Sources/KSCrashReportingCore/KSHTTPMultipartPostBody.m +++ b/Sources/KSCrashReportingCore/KSHTTPMultipartPostBody.m @@ -48,16 +48,16 @@ static void appendUTF8Format(NSMutableData *data, NSString *format, ...) @interface KSHTTPPostField : NSObject /** This field's binary encoded contents. */ -@property(nonatomic, readonly, retain) NSData *data; +@property(nonatomic, readonly, copy) NSData *data; /** This field's name. */ -@property(nonatomic, readonly, retain) NSString *name; +@property(nonatomic, readonly, copy) NSString *name; /** This field's content-type. */ -@property(nonatomic, readonly, retain) NSString *contentType; +@property(nonatomic, readonly, copy) NSString *contentType; /** This field's filename. */ -@property(nonatomic, readonly, retain) NSString *filename; +@property(nonatomic, readonly, copy) NSString *filename; + (KSHTTPPostField *)data:(NSData *)data name:(NSString *)name @@ -73,11 +73,6 @@ - (id)initWithData:(NSData *)data @implementation KSHTTPPostField -@synthesize data = _data; -@synthesize name = _name; -@synthesize contentType = _contentType; -@synthesize filename = _filename; - + (KSHTTPPostField *)data:(NSData *)data name:(NSString *)name contentType:(NSString *)contentType @@ -95,10 +90,10 @@ - (id)initWithData:(NSData *)data NSParameterAssert(name); if ((self = [super init])) { - _data = data; - _name = name; - _contentType = contentType; - _filename = filename; + _data = [data copy]; + _name = [name copy]; + _contentType = [contentType copy]; + _filename = [filename copy]; } return self; } @@ -107,17 +102,13 @@ - (id)initWithData:(NSData *)data @interface KSHTTPMultipartPostBody () -@property(nonatomic, readwrite, retain) NSMutableArray *fields; -@property(nonatomic, readwrite, retain) NSString *boundary; +@property(nonatomic, readwrite, strong) NSMutableArray *fields; +@property(nonatomic, readwrite, copy) NSString *boundary; @end @implementation KSHTTPMultipartPostBody -@synthesize contentType = _contentType; -@synthesize fields = _fields; -@synthesize boundary = _boundary; - + (KSHTTPMultipartPostBody *)body { return [[self alloc] init]; diff --git a/Sources/KSCrashReportingCore/KSReachabilityKSCrash.m b/Sources/KSCrashReportingCore/KSReachabilityKSCrash.m index 6f9a12b2..70265688 100644 --- a/Sources/KSCrashReportingCore/KSReachabilityKSCrash.m +++ b/Sources/KSCrashReportingCore/KSReachabilityKSCrash.m @@ -35,7 +35,7 @@ #if KSCRASH_HAS_REACHABILITY @interface KSReachabilityKSCrash () -@property(nonatomic, readwrite, retain) NSString *hostname; +@property(nonatomic, readwrite, copy) NSString *hostname; @property(nonatomic, readwrite, assign) SCNetworkReachabilityFlags flags; @property(nonatomic, readwrite, assign) BOOL reachable; @property(nonatomic, readwrite, assign) BOOL WWANOnly; @@ -57,14 +57,6 @@ - (void)onReachabilityFlagsChanged:(SCNetworkReachabilityFlags)flags; @implementation KSReachabilityKSCrash -@synthesize onReachabilityChanged = _onReachabilityChanged; -@synthesize flags = _flags; -@synthesize reachable = _reachable; -@synthesize WWANOnly = _WWANOnly; -@synthesize reachabilityRef = _reachabilityRef; -@synthesize hostname = _hostname; -@synthesize notificationName = _notificationName; - + (KSReachabilityKSCrash *)reachabilityToHost:(NSString *)hostname { return [[self alloc] initWithHost:hostname]; @@ -132,7 +124,7 @@ - (id)initWithReachabilityRef:(SCNetworkReachabilityRef)reachabilityRef } }); - self.reachabilityRef = reachabilityRef; + _reachabilityRef = reachabilityRef; return self; } @@ -141,7 +133,7 @@ - (id)initWithReachabilityRef:(SCNetworkReachabilityRef)reachabilityRef if (reachabilityRef) { CFRelease(reachabilityRef); } - self.reachabilityRef = NULL; + _reachabilityRef = NULL; return nil; } @@ -249,14 +241,12 @@ static void onReachabilityChanged(__unused SCNetworkReachabilityRef target, SCNe @interface KSReachableOperationKSCrash () -@property(nonatomic, readwrite, retain) KSReachabilityKSCrash *reachability; +@property(nonatomic, readwrite, strong) KSReachabilityKSCrash *reachability; @end @implementation KSReachableOperationKSCrash -@synthesize reachability = _reachability; - + (KSReachableOperationKSCrash *)operationWithHost:(NSString *)host allowWWAN:(BOOL)allowWWAN block:(void (^)(void))block @@ -267,14 +257,14 @@ + (KSReachableOperationKSCrash *)operationWithHost:(NSString *)host - (id)initWithHost:(NSString *)host allowWWAN:(BOOL)allowWWAN block:(void (^)(void))block { if ((self = [super init])) { - self.reachability = [KSReachabilityKSCrash reachabilityToHost:host]; + _reachability = [KSReachabilityKSCrash reachabilityToHost:host]; - __unsafe_unretained KSReachableOperationKSCrash *blockSelf = self; - self.reachability.onReachabilityChanged = ^(KSReachabilityKSCrash *reachability) { + __weak __typeof(self) weakSelf = self; + _reachability.onReachabilityChanged = ^(KSReachabilityKSCrash *reachability) { if (reachability.reachable) { if (allowWWAN || !reachability.WWANOnly) { block(); - blockSelf.reachability = nil; + weakSelf.reachability = nil; } } }; @@ -288,12 +278,6 @@ - (id)initWithHost:(NSString *)host allowWWAN:(BOOL)allowWWAN block:(void (^)(vo @implementation KSReachabilityKSCrash -@synthesize onReachabilityChanged = _onReachabilityChanged; -@synthesize reachable = _reachable; -@synthesize WWANOnly = _WWANOnly; -@synthesize hostname = _hostname; -@synthesize notificationName = _notificationName; - + (KSReachabilityKSCrash *)reachabilityToHost:(__unused NSString *)hostname { return [[self alloc] init]; diff --git a/Sources/KSCrashReportingCore/include/KSHTTPMultipartPostBody.h b/Sources/KSCrashReportingCore/include/KSHTTPMultipartPostBody.h index 991860fd..c89810bd 100644 --- a/Sources/KSCrashReportingCore/include/KSHTTPMultipartPostBody.h +++ b/Sources/KSCrashReportingCore/include/KSHTTPMultipartPostBody.h @@ -32,7 +32,7 @@ @interface KSHTTPMultipartPostBody : NSObject /** The content-type identifier for this body. */ -@property(nonatomic, readonly, retain) NSString *contentType; +@property(nonatomic, readonly, copy) NSString *contentType; /** Constructor. * diff --git a/Sources/KSCrashReportingCore/include/KSReachabilityKSCrash.h b/Sources/KSCrashReportingCore/include/KSReachabilityKSCrash.h index 4346d04a..42a7490b 100644 --- a/Sources/KSCrashReportingCore/include/KSReachabilityKSCrash.h +++ b/Sources/KSCrashReportingCore/include/KSReachabilityKSCrash.h @@ -64,7 +64,7 @@ #pragma mark General Information /** The host we are monitoring reachability to, if any. */ -@property(nonatomic, readonly, retain) NSString *hostname; +@property(nonatomic, readonly, copy) NSString *hostname; #pragma mark Notifications and Callbacks @@ -76,7 +76,7 @@ /** The notification to send when reachability changes (nil = don't send). * Default = nil */ -@property(nonatomic, readwrite, retain) NSString *notificationName; +@property(nonatomic, readwrite, copy) NSString *notificationName; #pragma mark KVO Compliant Status Properties diff --git a/Sources/KSCrashSinks/KSCrashReportSinkEMail.m b/Sources/KSCrashSinks/KSCrashReportSinkEMail.m index edeebb63..1cfa5a7f 100644 --- a/Sources/KSCrashSinks/KSCrashReportSinkEMail.m +++ b/Sources/KSCrashSinks/KSCrashReportSinkEMail.m @@ -45,7 +45,7 @@ @interface KSCrashMailProcess : NSObject @property(nonatomic, readwrite, copy) NSArray *reports; @property(nonatomic, readwrite, copy) KSCrashReportFilterCompletion onCompletion; -@property(nonatomic, readwrite, retain) UIViewController *dummyVC; +@property(nonatomic, readwrite, strong) UIViewController *dummyVC; + (KSCrashMailProcess *)process; @@ -61,10 +61,6 @@ - (void)dismissModalVC; @implementation KSCrashMailProcess -@synthesize reports = _reports; -@synthesize onCompletion = _onCompletion; -@synthesize dummyVC = _dummyVC; - + (KSCrashMailProcess *)process { return [[self alloc] init]; @@ -164,23 +160,15 @@ - (void)dismissModalVC @interface KSCrashReportSinkEMail () -@property(nonatomic, readwrite, retain) NSArray *recipients; - -@property(nonatomic, readwrite, retain) NSString *subject; - -@property(nonatomic, readwrite, retain) NSString *message; - -@property(nonatomic, readwrite, retain) NSString *filenameFmt; +@property(nonatomic, readwrite, copy) NSArray *recipients; +@property(nonatomic, readwrite, copy) NSString *subject; +@property(nonatomic, readwrite, copy) NSString *message; +@property(nonatomic, readwrite, copy) NSString *filenameFmt; @end @implementation KSCrashReportSinkEMail -@synthesize recipients = _recipients; -@synthesize subject = _subject; -@synthesize message = _message; -@synthesize filenameFmt = _filenameFmt; - + (instancetype)sinkWithRecipients:(NSArray *)recipients subject:(NSString *)subject message:(nullable NSString *)message @@ -195,10 +183,10 @@ - (instancetype)initWithRecipients:(NSArray *)recipients filenameFmt:(NSString *)filenameFmt { if ((self = [super init])) { - self.recipients = recipients; - self.subject = subject; - self.message = message; - self.filenameFmt = filenameFmt; + _recipients = [recipients copy]; + _subject = [subject copy]; + _message = [message copy]; + _filenameFmt = [filenameFmt copy]; } return self; } diff --git a/Sources/KSCrashSinks/KSCrashReportSinkStandard.m b/Sources/KSCrashSinks/KSCrashReportSinkStandard.m index 1c613528..f8f9b266 100644 --- a/Sources/KSCrashSinks/KSCrashReportSinkStandard.m +++ b/Sources/KSCrashSinks/KSCrashReportSinkStandard.m @@ -38,17 +38,14 @@ @interface KSCrashReportSinkStandard () -@property(nonatomic, readwrite, retain) NSURL *url; +@property(nonatomic, readwrite, strong) NSURL *url; -@property(nonatomic, readwrite, retain) KSReachableOperationKSCrash *reachableOperation; +@property(nonatomic, readwrite, strong) KSReachableOperationKSCrash *reachableOperation; @end @implementation KSCrashReportSinkStandard -@synthesize url = _url; -@synthesize reachableOperation = _reachableOperation; - + (instancetype)sinkWithURL:(NSURL *)url { return [[self alloc] initWithURL:url]; @@ -57,7 +54,7 @@ + (instancetype)sinkWithURL:(NSURL *)url - (instancetype)initWithURL:(NSURL *)url { if ((self = [super init])) { - self.url = url; + _url = url; } return self; } diff --git a/Sources/KSCrashTestTools/FileBasedTestCase.m b/Sources/KSCrashTestTools/FileBasedTestCase.m index da23942b..d08605ec 100644 --- a/Sources/KSCrashTestTools/FileBasedTestCase.m +++ b/Sources/KSCrashTestTools/FileBasedTestCase.m @@ -29,8 +29,6 @@ @implementation FileBasedTestCase -@synthesize tempPath = _tempPath; - - (void)setUp { [super setUp]; diff --git a/Sources/KSCrashTestTools/TestThread.m b/Sources/KSCrashTestTools/TestThread.m index 5764296c..fb4c0f56 100644 --- a/Sources/KSCrashTestTools/TestThread.m +++ b/Sources/KSCrashTestTools/TestThread.m @@ -29,8 +29,6 @@ @implementation TestThread -@synthesize thread = _thread; - - (void)main { self.thread = (thread_t)ksthread_self(); diff --git a/Sources/KSCrashTestTools/include/FileBasedTestCase.h b/Sources/KSCrashTestTools/include/FileBasedTestCase.h index 5a2a4fa9..73b4a858 100644 --- a/Sources/KSCrashTestTools/include/FileBasedTestCase.h +++ b/Sources/KSCrashTestTools/include/FileBasedTestCase.h @@ -28,7 +28,7 @@ @interface FileBasedTestCase : XCTestCase -@property(nonatomic, readwrite, retain) NSString *tempPath; +@property(nonatomic, readwrite, copy) NSString *tempPath; - (NSString *)generateTempFilePath; - (NSString *)generateFileWithData:(NSData *)data; diff --git a/Tests/KSCrashFiltersTests/KSCrashReportFilter_Tests.m b/Tests/KSCrashFiltersTests/KSCrashReportFilter_Tests.m index 7718510c..0c753e86 100644 --- a/Tests/KSCrashFiltersTests/KSCrashReportFilter_Tests.m +++ b/Tests/KSCrashFiltersTests/KSCrashReportFilter_Tests.m @@ -54,22 +54,15 @@ @interface KSCrash_TestFilter : NSObject @property(nonatomic, readwrite, assign) NSTimeInterval delay; @property(nonatomic, readwrite, assign) BOOL completed; -@property(nonatomic, readwrite, retain) NSError *error; -@property(nonatomic, readwrite, retain) NSTimer *timer; -@property(nonatomic, readwrite, retain) NSArray *reports; +@property(nonatomic, readwrite, strong) NSError *error; +@property(nonatomic, readwrite, strong) NSTimer *timer; +@property(nonatomic, readwrite, copy) NSArray *reports; @property(nonatomic, readwrite, copy) KSCrashReportFilterCompletion onCompletion; @end @implementation KSCrash_TestFilter -@synthesize delay = _delay; -@synthesize completed = _completed; -@synthesize error = _error; -@synthesize reports = _reports; -@synthesize timer = _timer; -@synthesize onCompletion = _onCompletion; - + (KSCrash_TestFilter *)filterWithDelay:(NSTimeInterval)delay completed:(BOOL)completed error:(NSError *)error { return [[self alloc] initWithDelay:delay completed:completed error:error]; @@ -78,9 +71,9 @@ + (KSCrash_TestFilter *)filterWithDelay:(NSTimeInterval)delay completed:(BOOL)co - (id)initWithDelay:(NSTimeInterval)delay completed:(BOOL)completed error:(NSError *)error { if ((self = [super init])) { - self.delay = delay; - self.completed = completed; - self.error = error; + _delay = delay; + _completed = completed; + _error = error; } return self; } diff --git a/Tests/KSCrashRecordingCoreTests/KSLogger_Tests.m b/Tests/KSCrashRecordingCoreTests/KSLogger_Tests.m index 16ed827c..7183f909 100644 --- a/Tests/KSCrashRecordingCoreTests/KSLogger_Tests.m +++ b/Tests/KSCrashRecordingCoreTests/KSLogger_Tests.m @@ -31,14 +31,12 @@ @interface KSLogger_Tests : XCTestCase -@property(nonatomic, readwrite, retain) NSString *tempDir; +@property(nonatomic, readwrite, copy) NSString *tempDir; @end @implementation KSLogger_Tests -@synthesize tempDir = _tempDir; - - (void)setUp { [super setUp]; diff --git a/Tests/KSCrashRecordingTests/KSCrashReportStore_Tests.m b/Tests/KSCrashRecordingTests/KSCrashReportStore_Tests.m index 44831e1c..90aa6215 100644 --- a/Tests/KSCrashRecordingTests/KSCrashReportStore_Tests.m +++ b/Tests/KSCrashRecordingTests/KSCrashReportStore_Tests.m @@ -34,18 +34,14 @@ @interface KSCrashReportStore_Tests : FileBasedTestCase -@property(nonatomic, readwrite, retain) NSString *appName; -@property(nonatomic, readwrite, retain) NSString *reportStorePath; +@property(nonatomic, readwrite, copy) NSString *appName; +@property(nonatomic, readwrite, copy) NSString *reportStorePath; @property(atomic, readwrite, assign) int64_t reportCounter; @end @implementation KSCrashReportStore_Tests -@synthesize appName = _appName; -@synthesize reportStorePath = _reportStorePath; -@synthesize reportCounter = _reportCounter; - - (int64_t)getReportIDFromPath:(NSString *)path { const char *filename = path.lastPathComponent.UTF8String;