Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions AvoidCrash/NSMutableAttributedString+AvoidCrash.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ + (void)avoidCrashExchangeMethod {

//initWithString:attributes:
[AvoidCrash exchangeInstanceMethod:NSConcreteMutableAttributedString method1Sel:@selector(initWithString:attributes:) method2Sel:@selector(avoidCrashInitWithString:attributes:)];

//replaceCharactersInRange:withString:
[AvoidCrash exchangeInstanceMethod:NSConcreteMutableAttributedString method1Sel:@selector(replaceCharactersInRange:withString:) method2Sel:@selector(avoidCrashReplaceCharactersInRange:withString:)];
});
}

Expand Down Expand Up @@ -71,4 +74,25 @@ - (instancetype)avoidCrashInitWithString:(NSString *)str attributes:(NSDictionar
}


//=================================================================
// replaceCharactersInRange:withString:
//=================================================================
#pragma mark - replaceCharactersInRange:withString:


- (void)avoidCrashReplaceCharactersInRange:(NSRange)range withString:(NSString *)aString {

@try {
[self avoidCrashReplaceCharactersInRange:range withString:aString];
} @catch (NSException *exception) {

NSString *defaultToDo = AvoidCrashDefaultReturnNil;
[AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];

} @finally {

}
}


@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>