├── .DS_Store ├── .gitignore ├── CrashCategory.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata └── CrashCategory ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Crash ├── NSObject+Crash.h └── NSObject+Crash.m ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Minlison/Categories/49b83f2769452e7cb635ccb691a23b14e4b56de2/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /CrashCategory.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F30200F31CE311E40076EB8A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F30200F21CE311E40076EB8A /* main.m */; }; 11 | F30200F61CE311E40076EB8A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F30200F51CE311E40076EB8A /* AppDelegate.m */; }; 12 | F30200F91CE311E40076EB8A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F30200F81CE311E40076EB8A /* ViewController.m */; }; 13 | F30200FC1CE311E40076EB8A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F30200FA1CE311E40076EB8A /* Main.storyboard */; }; 14 | F30200FE1CE311E40076EB8A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F30200FD1CE311E40076EB8A /* Assets.xcassets */; }; 15 | F30201011CE311E40076EB8A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F30200FF1CE311E40076EB8A /* LaunchScreen.storyboard */; }; 16 | F302010B1CE312290076EB8A /* NSObject+Crash.m in Sources */ = {isa = PBXBuildFile; fileRef = F302010A1CE312290076EB8A /* NSObject+Crash.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | F30200EE1CE311E40076EB8A /* CrashCategory.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CrashCategory.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | F30200F21CE311E40076EB8A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 22 | F30200F41CE311E40076EB8A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 23 | F30200F51CE311E40076EB8A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 24 | F30200F71CE311E40076EB8A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 25 | F30200F81CE311E40076EB8A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 26 | F30200FB1CE311E40076EB8A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | F30200FD1CE311E40076EB8A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | F30201001CE311E40076EB8A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | F30201021CE311E40076EB8A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | F30201091CE312290076EB8A /* NSObject+Crash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Crash.h"; sourceTree = ""; }; 31 | F302010A1CE312290076EB8A /* NSObject+Crash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+Crash.m"; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | F30200EB1CE311E40076EB8A /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | F30200E51CE311E40076EB8A = { 46 | isa = PBXGroup; 47 | children = ( 48 | F30200F01CE311E40076EB8A /* CrashCategory */, 49 | F30200EF1CE311E40076EB8A /* Products */, 50 | ); 51 | sourceTree = ""; 52 | }; 53 | F30200EF1CE311E40076EB8A /* Products */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | F30200EE1CE311E40076EB8A /* CrashCategory.app */, 57 | ); 58 | name = Products; 59 | sourceTree = ""; 60 | }; 61 | F30200F01CE311E40076EB8A /* CrashCategory */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | F30201081CE312290076EB8A /* Crash */, 65 | F30200F41CE311E40076EB8A /* AppDelegate.h */, 66 | F30200F51CE311E40076EB8A /* AppDelegate.m */, 67 | F30200F71CE311E40076EB8A /* ViewController.h */, 68 | F30200F81CE311E40076EB8A /* ViewController.m */, 69 | F30200FA1CE311E40076EB8A /* Main.storyboard */, 70 | F30200FD1CE311E40076EB8A /* Assets.xcassets */, 71 | F30200FF1CE311E40076EB8A /* LaunchScreen.storyboard */, 72 | F30201021CE311E40076EB8A /* Info.plist */, 73 | F30200F11CE311E40076EB8A /* Supporting Files */, 74 | ); 75 | path = CrashCategory; 76 | sourceTree = ""; 77 | }; 78 | F30200F11CE311E40076EB8A /* Supporting Files */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | F30200F21CE311E40076EB8A /* main.m */, 82 | ); 83 | name = "Supporting Files"; 84 | sourceTree = ""; 85 | }; 86 | F30201081CE312290076EB8A /* Crash */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | F30201091CE312290076EB8A /* NSObject+Crash.h */, 90 | F302010A1CE312290076EB8A /* NSObject+Crash.m */, 91 | ); 92 | path = Crash; 93 | sourceTree = ""; 94 | }; 95 | /* End PBXGroup section */ 96 | 97 | /* Begin PBXNativeTarget section */ 98 | F30200ED1CE311E40076EB8A /* CrashCategory */ = { 99 | isa = PBXNativeTarget; 100 | buildConfigurationList = F30201051CE311E40076EB8A /* Build configuration list for PBXNativeTarget "CrashCategory" */; 101 | buildPhases = ( 102 | F30200EA1CE311E40076EB8A /* Sources */, 103 | F30200EB1CE311E40076EB8A /* Frameworks */, 104 | F30200EC1CE311E40076EB8A /* Resources */, 105 | ); 106 | buildRules = ( 107 | ); 108 | dependencies = ( 109 | ); 110 | name = CrashCategory; 111 | productName = CrashCategory; 112 | productReference = F30200EE1CE311E40076EB8A /* CrashCategory.app */; 113 | productType = "com.apple.product-type.application"; 114 | }; 115 | /* End PBXNativeTarget section */ 116 | 117 | /* Begin PBXProject section */ 118 | F30200E61CE311E40076EB8A /* Project object */ = { 119 | isa = PBXProject; 120 | attributes = { 121 | LastUpgradeCheck = 0730; 122 | ORGANIZATIONNAME = orgz; 123 | TargetAttributes = { 124 | F30200ED1CE311E40076EB8A = { 125 | CreatedOnToolsVersion = 7.3; 126 | }; 127 | }; 128 | }; 129 | buildConfigurationList = F30200E91CE311E40076EB8A /* Build configuration list for PBXProject "CrashCategory" */; 130 | compatibilityVersion = "Xcode 3.2"; 131 | developmentRegion = English; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | Base, 136 | ); 137 | mainGroup = F30200E51CE311E40076EB8A; 138 | productRefGroup = F30200EF1CE311E40076EB8A /* Products */; 139 | projectDirPath = ""; 140 | projectRoot = ""; 141 | targets = ( 142 | F30200ED1CE311E40076EB8A /* CrashCategory */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXResourcesBuildPhase section */ 148 | F30200EC1CE311E40076EB8A /* Resources */ = { 149 | isa = PBXResourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | F30201011CE311E40076EB8A /* LaunchScreen.storyboard in Resources */, 153 | F30200FE1CE311E40076EB8A /* Assets.xcassets in Resources */, 154 | F30200FC1CE311E40076EB8A /* Main.storyboard in Resources */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXResourcesBuildPhase section */ 159 | 160 | /* Begin PBXSourcesBuildPhase section */ 161 | F30200EA1CE311E40076EB8A /* Sources */ = { 162 | isa = PBXSourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | F30200F91CE311E40076EB8A /* ViewController.m in Sources */, 166 | F30200F61CE311E40076EB8A /* AppDelegate.m in Sources */, 167 | F30200F31CE311E40076EB8A /* main.m in Sources */, 168 | F302010B1CE312290076EB8A /* NSObject+Crash.m in Sources */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXSourcesBuildPhase section */ 173 | 174 | /* Begin PBXVariantGroup section */ 175 | F30200FA1CE311E40076EB8A /* Main.storyboard */ = { 176 | isa = PBXVariantGroup; 177 | children = ( 178 | F30200FB1CE311E40076EB8A /* Base */, 179 | ); 180 | name = Main.storyboard; 181 | sourceTree = ""; 182 | }; 183 | F30200FF1CE311E40076EB8A /* LaunchScreen.storyboard */ = { 184 | isa = PBXVariantGroup; 185 | children = ( 186 | F30201001CE311E40076EB8A /* Base */, 187 | ); 188 | name = LaunchScreen.storyboard; 189 | sourceTree = ""; 190 | }; 191 | /* End PBXVariantGroup section */ 192 | 193 | /* Begin XCBuildConfiguration section */ 194 | F30201031CE311E40076EB8A /* Debug */ = { 195 | isa = XCBuildConfiguration; 196 | buildSettings = { 197 | ALWAYS_SEARCH_USER_PATHS = NO; 198 | CLANG_ANALYZER_NONNULL = YES; 199 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 200 | CLANG_CXX_LIBRARY = "libc++"; 201 | CLANG_ENABLE_MODULES = YES; 202 | CLANG_ENABLE_OBJC_ARC = YES; 203 | CLANG_WARN_BOOL_CONVERSION = YES; 204 | CLANG_WARN_CONSTANT_CONVERSION = YES; 205 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 206 | CLANG_WARN_EMPTY_BODY = YES; 207 | CLANG_WARN_ENUM_CONVERSION = YES; 208 | CLANG_WARN_INT_CONVERSION = YES; 209 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 210 | CLANG_WARN_UNREACHABLE_CODE = YES; 211 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 212 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 213 | COPY_PHASE_STRIP = NO; 214 | DEBUG_INFORMATION_FORMAT = dwarf; 215 | ENABLE_STRICT_OBJC_MSGSEND = YES; 216 | ENABLE_TESTABILITY = YES; 217 | GCC_C_LANGUAGE_STANDARD = gnu99; 218 | GCC_DYNAMIC_NO_PIC = NO; 219 | GCC_NO_COMMON_BLOCKS = YES; 220 | GCC_OPTIMIZATION_LEVEL = 0; 221 | GCC_PREPROCESSOR_DEFINITIONS = ( 222 | "DEBUG=1", 223 | "$(inherited)", 224 | ); 225 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 226 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 227 | GCC_WARN_UNDECLARED_SELECTOR = YES; 228 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 229 | GCC_WARN_UNUSED_FUNCTION = YES; 230 | GCC_WARN_UNUSED_VARIABLE = YES; 231 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 232 | MTL_ENABLE_DEBUG_INFO = YES; 233 | ONLY_ACTIVE_ARCH = YES; 234 | SDKROOT = iphoneos; 235 | }; 236 | name = Debug; 237 | }; 238 | F30201041CE311E40076EB8A /* Release */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | ALWAYS_SEARCH_USER_PATHS = NO; 242 | CLANG_ANALYZER_NONNULL = YES; 243 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 244 | CLANG_CXX_LIBRARY = "libc++"; 245 | CLANG_ENABLE_MODULES = YES; 246 | CLANG_ENABLE_OBJC_ARC = YES; 247 | CLANG_WARN_BOOL_CONVERSION = YES; 248 | CLANG_WARN_CONSTANT_CONVERSION = YES; 249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 250 | CLANG_WARN_EMPTY_BODY = YES; 251 | CLANG_WARN_ENUM_CONVERSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 254 | CLANG_WARN_UNREACHABLE_CODE = YES; 255 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 256 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 257 | COPY_PHASE_STRIP = NO; 258 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 259 | ENABLE_NS_ASSERTIONS = NO; 260 | ENABLE_STRICT_OBJC_MSGSEND = YES; 261 | GCC_C_LANGUAGE_STANDARD = gnu99; 262 | GCC_NO_COMMON_BLOCKS = YES; 263 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 265 | GCC_WARN_UNDECLARED_SELECTOR = YES; 266 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 267 | GCC_WARN_UNUSED_FUNCTION = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 270 | MTL_ENABLE_DEBUG_INFO = NO; 271 | SDKROOT = iphoneos; 272 | VALIDATE_PRODUCT = YES; 273 | }; 274 | name = Release; 275 | }; 276 | F30201061CE311E40076EB8A /* Debug */ = { 277 | isa = XCBuildConfiguration; 278 | buildSettings = { 279 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 280 | INFOPLIST_FILE = CrashCategory/Info.plist; 281 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 282 | PRODUCT_BUNDLE_IDENTIFIER = com.chengzivr.CrashCategory; 283 | PRODUCT_NAME = "$(TARGET_NAME)"; 284 | }; 285 | name = Debug; 286 | }; 287 | F30201071CE311E40076EB8A /* Release */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 291 | INFOPLIST_FILE = CrashCategory/Info.plist; 292 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 293 | PRODUCT_BUNDLE_IDENTIFIER = com.chengzivr.CrashCategory; 294 | PRODUCT_NAME = "$(TARGET_NAME)"; 295 | }; 296 | name = Release; 297 | }; 298 | /* End XCBuildConfiguration section */ 299 | 300 | /* Begin XCConfigurationList section */ 301 | F30200E91CE311E40076EB8A /* Build configuration list for PBXProject "CrashCategory" */ = { 302 | isa = XCConfigurationList; 303 | buildConfigurations = ( 304 | F30201031CE311E40076EB8A /* Debug */, 305 | F30201041CE311E40076EB8A /* Release */, 306 | ); 307 | defaultConfigurationIsVisible = 0; 308 | defaultConfigurationName = Release; 309 | }; 310 | F30201051CE311E40076EB8A /* Build configuration list for PBXNativeTarget "CrashCategory" */ = { 311 | isa = XCConfigurationList; 312 | buildConfigurations = ( 313 | F30201061CE311E40076EB8A /* Debug */, 314 | F30201071CE311E40076EB8A /* Release */, 315 | ); 316 | defaultConfigurationIsVisible = 0; 317 | }; 318 | /* End XCConfigurationList section */ 319 | }; 320 | rootObject = F30200E61CE311E40076EB8A /* Project object */; 321 | } 322 | -------------------------------------------------------------------------------- /CrashCategory.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CrashCategory/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CrashCategory 4 | // 5 | // Created by MinLison on 16/5/11. 6 | // Copyright © 2016年 orgz. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /CrashCategory/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CrashCategory 4 | // 5 | // Created by MinLison on 16/5/11. 6 | // Copyright © 2016年 orgz. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /CrashCategory/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /CrashCategory/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CrashCategory/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /CrashCategory/Crash/NSObject+Crash.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Cash.h 3 | // TestPredict 4 | // 5 | // Created by MinLison on 16/5/11. 6 | // Copyright © 2016年 orgz. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (Crash) 12 | 13 | @end 14 | @interface NSDictionary (Crash) 15 | 16 | @end 17 | @interface NSMutableDictionary(rCash) 18 | 19 | @end 20 | @interface NSArray (Crash) 21 | 22 | @end 23 | @interface NSMutableArray(Crash) 24 | 25 | @end -------------------------------------------------------------------------------- /CrashCategory/Crash/NSObject+Crash.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Crash.m 3 | // TestPredict 4 | // 5 | // Created by MinLison on 16/5/11. 6 | // Copyright © 2016年 orgz. All rights reserved. 7 | // 8 | 9 | #import "NSObject+Crash.h" 10 | #import 11 | #import 12 | #import 13 | 14 | static inline void swizzledMethod(Class class, SEL originalSelector, SEL swizzledSelector) 15 | { 16 | 17 | Method originalMethod = class_getInstanceMethod(class, originalSelector); 18 | Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector); 19 | 20 | BOOL didAddMethod = 21 | class_addMethod(class, 22 | originalSelector, 23 | method_getImplementation(swizzledMethod), 24 | method_getTypeEncoding(swizzledMethod)); 25 | 26 | if (didAddMethod) 27 | { 28 | class_replaceMethod(class, 29 | swizzledSelector, 30 | method_getImplementation(originalMethod), 31 | method_getTypeEncoding(originalMethod)); 32 | } 33 | else 34 | { 35 | method_exchangeImplementations(originalMethod, swizzledMethod); 36 | } 37 | } 38 | 39 | @implementation NSObject (Crash) 40 | 41 | @end 42 | @implementation NSDictionary (Crash) 43 | + (void)load 44 | { 45 | swizzledMethod(objc_getClass("__NSPlaceholderDictionary"), @selector(initWithObjects:forKeys:count:), @selector(cz_initWithObjects:forKeys:count:)); 46 | swizzledMethod(objc_getClass("__NSPlaceholderDictionary"), @selector(dictionaryWithObjects:forKeys:count:), @selector(cz_dictionaryWithObjects:forKeys:count:)); 47 | } 48 | - (instancetype)cz_initWithObjects:(const id _Nonnull __unsafe_unretained *)objects forKeys:(const id _Nonnull __unsafe_unretained *)keys count:(NSUInteger)cnt 49 | { 50 | @try 51 | { 52 | return [self cz_initWithObjects:objects forKeys:keys count:cnt]; 53 | } 54 | @catch (NSException *exception) 55 | { 56 | NSLog(@"-------- %s Crash Because Method %s -------\n",class_getName(self.class),__func__); 57 | NSLog(@"%@", [exception callStackSymbols]); 58 | 59 | #pragma clang diagnostic push 60 | #pragma clang diagnostic ignored"-Wincompatible-pointer-types-discards-qualifiers" 61 | 62 | __unsafe_unretained id *unsafe_objects = objects; 63 | __unsafe_unretained id *unsafe_keys = keys; 64 | 65 | #pragma clang diagnostic pop 66 | 67 | for (NSUInteger i = 0; i < cnt; i ++) 68 | { 69 | 70 | if (!unsafe_keys[i]) 71 | { 72 | unsafe_keys[i] = @""; 73 | } 74 | if (!unsafe_objects[i]) 75 | { 76 | unsafe_objects[i] = @""; 77 | } 78 | } 79 | return [self cz_initWithObjects:unsafe_objects forKeys:unsafe_keys count:cnt]; 80 | } 81 | @finally 82 | { 83 | } 84 | } 85 | + (instancetype)cz_dictionaryWithObjects:(const id _Nonnull __unsafe_unretained *)objects forKeys:(const id[])keys count:(NSUInteger)cnt 86 | { 87 | @try { 88 | return [self cz_dictionaryWithObjects:objects forKeys:keys count:cnt]; 89 | } @catch (NSException *exception) { 90 | 91 | NSLog(@"-------- %s Crash Because Method %s -------\n",class_getName(self.class),__func__); 92 | NSLog(@"%@", [exception callStackSymbols]); 93 | 94 | 95 | #pragma clang diagnostic push 96 | #pragma clang diagnostic ignored"-Wincompatible-pointer-types-discards-qualifiers" 97 | 98 | __unsafe_unretained id *unsafe_objects = objects; 99 | __unsafe_unretained id *unsafe_keys = keys; 100 | 101 | #pragma clang diagnostic pop 102 | 103 | for (NSUInteger i = 0; i < cnt; i ++) 104 | { 105 | 106 | if (!unsafe_keys[i]) 107 | { 108 | unsafe_keys[i] = @""; 109 | } 110 | if (!unsafe_objects[i]) 111 | { 112 | unsafe_objects[i] = @""; 113 | } 114 | } 115 | 116 | return [self cz_dictionaryWithObjects:objects forKeys:keys count:cnt]; 117 | 118 | } 119 | @finally 120 | { 121 | } 122 | } 123 | @end 124 | 125 | @implementation NSArray (Crash) 126 | 127 | + (void)load 128 | { 129 | swizzledMethod(objc_getClass("__NSArrayI"), @selector(objectAtIndex:), @selector(cz_objectAtIndex:)); 130 | swizzledMethod(objc_getClass("__NSArrayI"), @selector(arrayWithObjects:count:), @selector(cz_arrayWithObjects:count:)); 131 | } 132 | 133 | + (instancetype)cz_arrayWithObjects:(const id _Nonnull __unsafe_unretained *)objects count:(NSUInteger)cnt 134 | { 135 | @try 136 | { 137 | return [self cz_arrayWithObjects:objects count:cnt]; 138 | } 139 | @catch (NSException *exception) 140 | { 141 | NSLog(@"-------- %s Crash Because Method %s -------\n",class_getName(self.class),__func__); 142 | NSLog(@"%@", [exception callStackSymbols]); 143 | 144 | 145 | #pragma clang diagnostic push 146 | #pragma clang diagnostic ignored"-Wincompatible-pointer-types-discards-qualifiers" 147 | 148 | __unsafe_unretained id *unsafe_objects = objects; 149 | 150 | #pragma clang diagnostic pop 151 | 152 | 153 | for (NSUInteger i = 0; i < cnt; i ++) { 154 | if (!unsafe_objects[i]) 155 | { 156 | unsafe_objects[i] = @""; 157 | } 158 | } 159 | 160 | return [self cz_arrayWithObjects:objects count:cnt]; 161 | 162 | } 163 | @finally 164 | { 165 | } 166 | 167 | } 168 | 169 | - (id)cz_objectAtIndex:(NSUInteger)index { 170 | if (self.count - 1 > index) { 171 | @try { 172 | return[self cz_objectAtIndex:index]; 173 | } 174 | @catch (NSException *exception) { 175 | NSLog(@"-------- %s Crash Because Method %s -------\n",class_getName(self.class),__func__); 176 | NSLog(@"%@", [exception callStackSymbols]); 177 | return nil; 178 | } 179 | @finally 180 | { 181 | } 182 | }else { 183 | return [self cz_objectAtIndex:index]; 184 | } 185 | } 186 | @end 187 | 188 | @implementation NSMutableArray (Crash) 189 | 190 | +(void)load 191 | { 192 | swizzledMethod(objc_getClass("__NSArrayM"), @selector(objectAtIndex:), @selector(cz_objectAtIndex:)); 193 | swizzledMethod(objc_getClass("__NSArrayM"), @selector(setObject:atIndexedSubscript:), @selector(cz_setObject:atIndexedSubscript:)); 194 | } 195 | 196 | - (id)cz_objectAtIndex:(NSUInteger)index { 197 | 198 | if (self.count - 1 > index) 199 | { 200 | @try { 201 | return[self cz_objectAtIndex:index]; 202 | } 203 | @catch (NSException *exception) { 204 | NSLog(@"-------- %s Crash Because Method %s -------\n",class_getName(self.class),__func__); 205 | NSLog(@"%@", [exception callStackSymbols]); 206 | return nil; 207 | } 208 | @finally 209 | { 210 | } 211 | } 212 | else 213 | { 214 | return [self cz_objectAtIndex:index]; 215 | } 216 | } 217 | 218 | - (void)cz_setObject:(id)obj atIndexedSubscript:(NSUInteger)idx 219 | { 220 | if (obj == nil || idx > self.count - 1) 221 | { 222 | @try 223 | { 224 | [self cz_setObject:obj atIndexedSubscript:idx]; 225 | } 226 | @catch (NSException *exception) 227 | { 228 | NSLog(@"-------- %s Crash Because Method %s -------\n",class_getName(self.class),__func__); 229 | NSLog(@"%@", [exception callStackSymbols]); 230 | 231 | } @finally { 232 | 233 | } 234 | 235 | } 236 | else 237 | { 238 | [self cz_setObject:obj atIndexedSubscript:idx]; 239 | } 240 | 241 | } 242 | 243 | @end 244 | @implementation NSMutableDictionary (Crash) 245 | 246 | + (void)load 247 | { 248 | swizzledMethod(objc_getClass("__NSDictionaryM"), @selector(setObject:forKey:), @selector(cz_setObject:forKey:)); 249 | } 250 | 251 | - (void)cz_setObject:(id)czObject forKey:(NSString *)key { 252 | 253 | if (czObject == nil || key == nil) { 254 | @try { 255 | [self cz_setObject:czObject forKey:key]; 256 | } 257 | @catch (NSException *exception) { 258 | NSLog(@"---------- %s Crash Because Method %s ----------\n", class_getName(self.class), __func__); 259 | NSLog(@"%@", [exception callStackSymbols]); 260 | czObject = [NSString stringWithFormat:@""]; 261 | [self cz_setObject:czObject forKey:key]; 262 | } 263 | @finally {} 264 | }else { 265 | [self cz_setObject:czObject forKey:key]; 266 | } 267 | } 268 | @end -------------------------------------------------------------------------------- /CrashCategory/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /CrashCategory/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CrashCategory 4 | // 5 | // Created by MinLison on 16/5/11. 6 | // Copyright © 2016年 orgz. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /CrashCategory/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CrashCategory 4 | // 5 | // Created by MinLison on 16/5/11. 6 | // Copyright © 2016年 orgz. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | NSDictionary *dcit = @{ 21 | @"name" : @(10), 22 | @"other": 23 | @{ 24 | @"name" : @(20) 25 | } 26 | }; 27 | NSDictionary *dcit1 = @{ 28 | @"name" : @(15), 29 | }; 30 | NSDictionary *dcit2 = @{ 31 | @"name" : @(30), 32 | }; 33 | 34 | NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary]; 35 | NSString *tmp = nil; 36 | NSDictionary *dictasd = @{ 37 | @"ceshiceshiceshi key1" : @"afs", 38 | @"ceshiceshiceshi key2" : tmp, 39 | @"ceshiceshiceshi key3" : @"55" 40 | }; 41 | NSLog(@"%@",dictasd); 42 | 43 | NSMutableArray *array = [NSMutableArray arrayWithCapacity:2]; 44 | [array setObject:tmp atIndexedSubscript:0]; 45 | array[1] = tmp; 46 | NSLog(@"%@",array[10]); 47 | 48 | } 49 | 50 | - (void)didReceiveMemoryWarning { 51 | [super didReceiveMemoryWarning]; 52 | // Dispose of any resources that can be recreated. 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /CrashCategory/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CrashCategory 4 | // 5 | // Created by MinLison on 16/5/11. 6 | // Copyright © 2016年 orgz. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | --------------------------------------------------------------------------------