├── README.txt └── bengkui ├── .DS_Store ├── bengkui.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ ├── rainbird.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── zhanglei.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── rainbird.xcuserdatad │ └── xcschemes │ │ ├── bengkui.xcscheme │ │ └── xcschememanagement.plist │ └── zhanglei.xcuserdatad │ └── xcschemes │ ├── bengkui.xcscheme │ └── xcschememanagement.plist └── bengkui ├── .DS_Store ├── AppDelegate.h ├── AppDelegate.m ├── UncaughtExceptionHandler.h ├── UncaughtExceptionHandler.m ├── ViewController.h ├── ViewController.m ├── bengkui-Info.plist ├── bengkui-Prefix.pch ├── en.lproj ├── InfoPlist.strings └── ViewController.xib └── main.m /README.txt: -------------------------------------------------------------------------------- 1 | 让程序从容的崩溃 2 | 1、首先需要在appDelegate中使用InstallUncaughtExceptionHandler()用于监听 3 | 2、添加UncaughtExceptionHandler这个类 4 | 5 | iOS SDK提供的函数是NSSetUncaughtExceptionHandler来进行异常处理。但是无法处理内存访问错误、重复释放等错误,因为这些错误发送的SIGNAL。所以需要处理这些SIGNAL 6 | -------------------------------------------------------------------------------- /bengkui/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minibear0523/UncaughtExceptionHandler/b4655fa2f0e9a7f8f5da53050614fd87672bfe75/bengkui/.DS_Store -------------------------------------------------------------------------------- /bengkui/bengkui.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | EBFBDD5715F065D3000B9B23 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBFBDD5615F065D3000B9B23 /* UIKit.framework */; }; 11 | EBFBDD5915F065D3000B9B23 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBFBDD5815F065D3000B9B23 /* Foundation.framework */; }; 12 | EBFBDD5B15F065D3000B9B23 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBFBDD5A15F065D3000B9B23 /* CoreGraphics.framework */; }; 13 | EBFBDD6115F065D3000B9B23 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EBFBDD5F15F065D3000B9B23 /* InfoPlist.strings */; }; 14 | EBFBDD6315F065D3000B9B23 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EBFBDD6215F065D3000B9B23 /* main.m */; }; 15 | EBFBDD6715F065D3000B9B23 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EBFBDD6615F065D3000B9B23 /* AppDelegate.m */; }; 16 | EBFBDD6A15F065D3000B9B23 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EBFBDD6915F065D3000B9B23 /* ViewController.m */; }; 17 | EBFBDD6D15F065D3000B9B23 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = EBFBDD6B15F065D3000B9B23 /* ViewController.xib */; }; 18 | EBFBDD7515F06679000B9B23 /* UncaughtExceptionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = EBFBDD7415F06679000B9B23 /* UncaughtExceptionHandler.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | EBFBDD5215F065D3000B9B23 /* bengkui.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = bengkui.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | EBFBDD5615F065D3000B9B23 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 24 | EBFBDD5815F065D3000B9B23 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 25 | EBFBDD5A15F065D3000B9B23 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 26 | EBFBDD5E15F065D3000B9B23 /* bengkui-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "bengkui-Info.plist"; sourceTree = ""; }; 27 | EBFBDD6015F065D3000B9B23 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 28 | EBFBDD6215F065D3000B9B23 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | EBFBDD6415F065D3000B9B23 /* bengkui-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "bengkui-Prefix.pch"; sourceTree = ""; }; 30 | EBFBDD6515F065D3000B9B23 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 31 | EBFBDD6615F065D3000B9B23 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 32 | EBFBDD6815F065D3000B9B23 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 33 | EBFBDD6915F065D3000B9B23 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 34 | EBFBDD6C15F065D3000B9B23 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = ""; }; 35 | EBFBDD7315F06679000B9B23 /* UncaughtExceptionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UncaughtExceptionHandler.h; sourceTree = ""; }; 36 | EBFBDD7415F06679000B9B23 /* UncaughtExceptionHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UncaughtExceptionHandler.m; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | EBFBDD4F15F065D3000B9B23 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | EBFBDD5715F065D3000B9B23 /* UIKit.framework in Frameworks */, 45 | EBFBDD5915F065D3000B9B23 /* Foundation.framework in Frameworks */, 46 | EBFBDD5B15F065D3000B9B23 /* CoreGraphics.framework in Frameworks */, 47 | ); 48 | runOnlyForDeploymentPostprocessing = 0; 49 | }; 50 | /* End PBXFrameworksBuildPhase section */ 51 | 52 | /* Begin PBXGroup section */ 53 | EBFBDD4715F065D3000B9B23 = { 54 | isa = PBXGroup; 55 | children = ( 56 | EBFBDD5C15F065D3000B9B23 /* bengkui */, 57 | EBFBDD5515F065D3000B9B23 /* Frameworks */, 58 | EBFBDD5315F065D3000B9B23 /* Products */, 59 | ); 60 | sourceTree = ""; 61 | }; 62 | EBFBDD5315F065D3000B9B23 /* Products */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | EBFBDD5215F065D3000B9B23 /* bengkui.app */, 66 | ); 67 | name = Products; 68 | sourceTree = ""; 69 | }; 70 | EBFBDD5515F065D3000B9B23 /* Frameworks */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | EBFBDD5615F065D3000B9B23 /* UIKit.framework */, 74 | EBFBDD5815F065D3000B9B23 /* Foundation.framework */, 75 | EBFBDD5A15F065D3000B9B23 /* CoreGraphics.framework */, 76 | ); 77 | name = Frameworks; 78 | sourceTree = ""; 79 | }; 80 | EBFBDD5C15F065D3000B9B23 /* bengkui */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | EBFBDD6515F065D3000B9B23 /* AppDelegate.h */, 84 | EBFBDD6615F065D3000B9B23 /* AppDelegate.m */, 85 | EBFBDD6815F065D3000B9B23 /* ViewController.h */, 86 | EBFBDD6915F065D3000B9B23 /* ViewController.m */, 87 | EBFBDD6B15F065D3000B9B23 /* ViewController.xib */, 88 | EBFBDD7315F06679000B9B23 /* UncaughtExceptionHandler.h */, 89 | EBFBDD7415F06679000B9B23 /* UncaughtExceptionHandler.m */, 90 | EBFBDD5D15F065D3000B9B23 /* Supporting Files */, 91 | ); 92 | path = bengkui; 93 | sourceTree = ""; 94 | }; 95 | EBFBDD5D15F065D3000B9B23 /* Supporting Files */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | EBFBDD5E15F065D3000B9B23 /* bengkui-Info.plist */, 99 | EBFBDD5F15F065D3000B9B23 /* InfoPlist.strings */, 100 | EBFBDD6215F065D3000B9B23 /* main.m */, 101 | EBFBDD6415F065D3000B9B23 /* bengkui-Prefix.pch */, 102 | ); 103 | name = "Supporting Files"; 104 | sourceTree = ""; 105 | }; 106 | /* End PBXGroup section */ 107 | 108 | /* Begin PBXNativeTarget section */ 109 | EBFBDD5115F065D3000B9B23 /* bengkui */ = { 110 | isa = PBXNativeTarget; 111 | buildConfigurationList = EBFBDD7015F065D3000B9B23 /* Build configuration list for PBXNativeTarget "bengkui" */; 112 | buildPhases = ( 113 | EBFBDD4E15F065D3000B9B23 /* Sources */, 114 | EBFBDD4F15F065D3000B9B23 /* Frameworks */, 115 | EBFBDD5015F065D3000B9B23 /* Resources */, 116 | ); 117 | buildRules = ( 118 | ); 119 | dependencies = ( 120 | ); 121 | name = bengkui; 122 | productName = bengkui; 123 | productReference = EBFBDD5215F065D3000B9B23 /* bengkui.app */; 124 | productType = "com.apple.product-type.application"; 125 | }; 126 | /* End PBXNativeTarget section */ 127 | 128 | /* Begin PBXProject section */ 129 | EBFBDD4915F065D3000B9B23 /* Project object */ = { 130 | isa = PBXProject; 131 | attributes = { 132 | LastUpgradeCheck = 0440; 133 | ORGANIZATIONNAME = rainbird; 134 | }; 135 | buildConfigurationList = EBFBDD4C15F065D3000B9B23 /* Build configuration list for PBXProject "bengkui" */; 136 | compatibilityVersion = "Xcode 3.2"; 137 | developmentRegion = English; 138 | hasScannedForEncodings = 0; 139 | knownRegions = ( 140 | en, 141 | ); 142 | mainGroup = EBFBDD4715F065D3000B9B23; 143 | productRefGroup = EBFBDD5315F065D3000B9B23 /* Products */; 144 | projectDirPath = ""; 145 | projectRoot = ""; 146 | targets = ( 147 | EBFBDD5115F065D3000B9B23 /* bengkui */, 148 | ); 149 | }; 150 | /* End PBXProject section */ 151 | 152 | /* Begin PBXResourcesBuildPhase section */ 153 | EBFBDD5015F065D3000B9B23 /* Resources */ = { 154 | isa = PBXResourcesBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | EBFBDD6115F065D3000B9B23 /* InfoPlist.strings in Resources */, 158 | EBFBDD6D15F065D3000B9B23 /* ViewController.xib in Resources */, 159 | ); 160 | runOnlyForDeploymentPostprocessing = 0; 161 | }; 162 | /* End PBXResourcesBuildPhase section */ 163 | 164 | /* Begin PBXSourcesBuildPhase section */ 165 | EBFBDD4E15F065D3000B9B23 /* Sources */ = { 166 | isa = PBXSourcesBuildPhase; 167 | buildActionMask = 2147483647; 168 | files = ( 169 | EBFBDD6315F065D3000B9B23 /* main.m in Sources */, 170 | EBFBDD6715F065D3000B9B23 /* AppDelegate.m in Sources */, 171 | EBFBDD6A15F065D3000B9B23 /* ViewController.m in Sources */, 172 | EBFBDD7515F06679000B9B23 /* UncaughtExceptionHandler.m in Sources */, 173 | ); 174 | runOnlyForDeploymentPostprocessing = 0; 175 | }; 176 | /* End PBXSourcesBuildPhase section */ 177 | 178 | /* Begin PBXVariantGroup section */ 179 | EBFBDD5F15F065D3000B9B23 /* InfoPlist.strings */ = { 180 | isa = PBXVariantGroup; 181 | children = ( 182 | EBFBDD6015F065D3000B9B23 /* en */, 183 | ); 184 | name = InfoPlist.strings; 185 | sourceTree = ""; 186 | }; 187 | EBFBDD6B15F065D3000B9B23 /* ViewController.xib */ = { 188 | isa = PBXVariantGroup; 189 | children = ( 190 | EBFBDD6C15F065D3000B9B23 /* en */, 191 | ); 192 | name = ViewController.xib; 193 | sourceTree = ""; 194 | }; 195 | /* End PBXVariantGroup section */ 196 | 197 | /* Begin XCBuildConfiguration section */ 198 | EBFBDD6E15F065D3000B9B23 /* Debug */ = { 199 | isa = XCBuildConfiguration; 200 | buildSettings = { 201 | ALWAYS_SEARCH_USER_PATHS = NO; 202 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 203 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 204 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 205 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 206 | COPY_PHASE_STRIP = NO; 207 | GCC_C_LANGUAGE_STANDARD = gnu99; 208 | GCC_DYNAMIC_NO_PIC = NO; 209 | GCC_OPTIMIZATION_LEVEL = 0; 210 | GCC_PREPROCESSOR_DEFINITIONS = ( 211 | "DEBUG=1", 212 | "$(inherited)", 213 | ); 214 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 215 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 216 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 217 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 218 | GCC_WARN_UNUSED_VARIABLE = YES; 219 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 220 | SDKROOT = iphoneos; 221 | }; 222 | name = Debug; 223 | }; 224 | EBFBDD6F15F065D3000B9B23 /* Release */ = { 225 | isa = XCBuildConfiguration; 226 | buildSettings = { 227 | ALWAYS_SEARCH_USER_PATHS = NO; 228 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 229 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 230 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 231 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 232 | COPY_PHASE_STRIP = YES; 233 | GCC_C_LANGUAGE_STANDARD = gnu99; 234 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 235 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 236 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 237 | GCC_WARN_UNUSED_VARIABLE = YES; 238 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 239 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 240 | SDKROOT = iphoneos; 241 | VALIDATE_PRODUCT = YES; 242 | }; 243 | name = Release; 244 | }; 245 | EBFBDD7115F065D3000B9B23 /* Debug */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 249 | GCC_PREFIX_HEADER = "bengkui/bengkui-Prefix.pch"; 250 | INFOPLIST_FILE = "bengkui/bengkui-Info.plist"; 251 | PRODUCT_NAME = "$(TARGET_NAME)"; 252 | WRAPPER_EXTENSION = app; 253 | }; 254 | name = Debug; 255 | }; 256 | EBFBDD7215F065D3000B9B23 /* Release */ = { 257 | isa = XCBuildConfiguration; 258 | buildSettings = { 259 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 260 | GCC_PREFIX_HEADER = "bengkui/bengkui-Prefix.pch"; 261 | INFOPLIST_FILE = "bengkui/bengkui-Info.plist"; 262 | PRODUCT_NAME = "$(TARGET_NAME)"; 263 | WRAPPER_EXTENSION = app; 264 | }; 265 | name = Release; 266 | }; 267 | /* End XCBuildConfiguration section */ 268 | 269 | /* Begin XCConfigurationList section */ 270 | EBFBDD4C15F065D3000B9B23 /* Build configuration list for PBXProject "bengkui" */ = { 271 | isa = XCConfigurationList; 272 | buildConfigurations = ( 273 | EBFBDD6E15F065D3000B9B23 /* Debug */, 274 | EBFBDD6F15F065D3000B9B23 /* Release */, 275 | ); 276 | defaultConfigurationIsVisible = 0; 277 | defaultConfigurationName = Release; 278 | }; 279 | EBFBDD7015F065D3000B9B23 /* Build configuration list for PBXNativeTarget "bengkui" */ = { 280 | isa = XCConfigurationList; 281 | buildConfigurations = ( 282 | EBFBDD7115F065D3000B9B23 /* Debug */, 283 | EBFBDD7215F065D3000B9B23 /* Release */, 284 | ); 285 | defaultConfigurationIsVisible = 0; 286 | }; 287 | /* End XCConfigurationList section */ 288 | }; 289 | rootObject = EBFBDD4915F065D3000B9B23 /* Project object */; 290 | } 291 | -------------------------------------------------------------------------------- /bengkui/bengkui.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /bengkui/bengkui.xcodeproj/project.xcworkspace/xcuserdata/rainbird.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minibear0523/UncaughtExceptionHandler/b4655fa2f0e9a7f8f5da53050614fd87672bfe75/bengkui/bengkui.xcodeproj/project.xcworkspace/xcuserdata/rainbird.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /bengkui/bengkui.xcodeproj/project.xcworkspace/xcuserdata/zhanglei.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minibear0523/UncaughtExceptionHandler/b4655fa2f0e9a7f8f5da53050614fd87672bfe75/bengkui/bengkui.xcodeproj/project.xcworkspace/xcuserdata/zhanglei.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /bengkui/bengkui.xcodeproj/xcuserdata/rainbird.xcuserdatad/xcschemes/bengkui.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /bengkui/bengkui.xcodeproj/xcuserdata/rainbird.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | bengkui.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | EBFBDD5115F065D3000B9B23 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /bengkui/bengkui.xcodeproj/xcuserdata/zhanglei.xcuserdatad/xcschemes/bengkui.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /bengkui/bengkui.xcodeproj/xcuserdata/zhanglei.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | bengkui.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | EBFBDD5115F065D3000B9B23 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /bengkui/bengkui/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minibear0523/UncaughtExceptionHandler/b4655fa2f0e9a7f8f5da53050614fd87672bfe75/bengkui/bengkui/.DS_Store -------------------------------------------------------------------------------- /bengkui/bengkui/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // bengkui 4 | // 5 | // Created by rainbird on 12-8-31. 6 | // Copyright (c) 2012年 rainbird. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class ViewController; 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) ViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /bengkui/bengkui/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // bengkui 4 | // 5 | // Created by rainbird on 12-8-31. 6 | // Copyright (c) 2012年 rainbird. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "ViewController.h" 12 | #import "UncaughtExceptionHandler.h" 13 | @implementation AppDelegate 14 | 15 | - (void)dealloc{ 16 | [_window release]; 17 | [_viewController release]; 18 | [super dealloc]; 19 | } 20 | 21 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 22 | InstallUncaughtExceptionHandler(); 23 | self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 24 | // Override point for customization after application launch. 25 | self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease]; 26 | self.window.rootViewController = self.viewController; 27 | [self.window makeKeyAndVisible]; 28 | return YES; 29 | } 30 | 31 | - (void)applicationWillResignActive:(UIApplication *)application{ 32 | // 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. 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidEnterBackground:(UIApplication *)application 37 | { 38 | // 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. 39 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 40 | } 41 | 42 | - (void)applicationWillEnterForeground:(UIApplication *)application 43 | { 44 | // 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. 45 | } 46 | 47 | - (void)applicationDidBecomeActive:(UIApplication *)application 48 | { 49 | // 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. 50 | } 51 | 52 | - (void)applicationWillTerminate:(UIApplication *)application 53 | { 54 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /bengkui/bengkui/UncaughtExceptionHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // UncaughtExceptionHandler.h 3 | // UncaughtExceptions 4 | // 5 | // Created by Matt Gallagher on 2010/05/25. 6 | // Copyright 2010 Matt Gallagher. All rights reserved. 7 | // 8 | // Permission is given to use this source code file, free of charge, in any 9 | // project, commercial or otherwise, entirely at your risk, with the condition 10 | // that any redistribution (in part or whole) of source code must retain 11 | // this copyright and permission notice. Attribution in compiled projects is 12 | // appreciated but not required. 13 | // 14 | 15 | #import 16 | 17 | @interface UncaughtExceptionHandler : NSObject{ 18 | BOOL dismissed; 19 | } 20 | 21 | @end 22 | void HandleException(NSException *exception); 23 | void SignalHandler(int signal); 24 | 25 | 26 | void InstallUncaughtExceptionHandler(void); 27 | -------------------------------------------------------------------------------- /bengkui/bengkui/UncaughtExceptionHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // UncaughtExceptionHandler.m 3 | // UncaughtExceptions 4 | // 5 | // Created by Matt Gallagher on 2010/05/25. 6 | // Copyright 2010 Matt Gallagher. All rights reserved. 7 | // 8 | // Permission is given to use this source code file, free of charge, in any 9 | // project, commercial or otherwise, entirely at your risk, with the condition 10 | // that any redistribution (in part or whole) of source code must retain 11 | // this copyright and permission notice. Attribution in compiled projects is 12 | // appreciated but not required. 13 | // 14 | 15 | #import "UncaughtExceptionHandler.h" 16 | #include 17 | #include 18 | 19 | NSString * const UncaughtExceptionHandlerSignalExceptionName = @"UncaughtExceptionHandlerSignalExceptionName"; 20 | NSString * const UncaughtExceptionHandlerSignalKey = @"UncaughtExceptionHandlerSignalKey"; 21 | NSString * const UncaughtExceptionHandlerAddressesKey = @"UncaughtExceptionHandlerAddressesKey"; 22 | 23 | volatile int32_t UncaughtExceptionCount = 0; 24 | const int32_t UncaughtExceptionMaximum = 10; 25 | 26 | const NSInteger UncaughtExceptionHandlerSkipAddressCount = 4; 27 | const NSInteger UncaughtExceptionHandlerReportAddressCount = 5; 28 | 29 | @implementation UncaughtExceptionHandler 30 | 31 | + (NSArray *)backtrace 32 | { 33 | void* callstack[128]; 34 | int frames = backtrace(callstack, 128); 35 | char **strs = backtrace_symbols(callstack, frames); 36 | 37 | int i; 38 | NSMutableArray *backtrace = [NSMutableArray arrayWithCapacity:frames]; 39 | for ( 40 | i = UncaughtExceptionHandlerSkipAddressCount; 41 | i < UncaughtExceptionHandlerSkipAddressCount + 42 | UncaughtExceptionHandlerReportAddressCount; 43 | i++) 44 | { 45 | [backtrace addObject:[NSString stringWithUTF8String:strs[i]]]; 46 | } 47 | free(strs); 48 | 49 | return backtrace; 50 | } 51 | 52 | - (void)alertView:(UIAlertView *)anAlertView clickedButtonAtIndex:(NSInteger)anIndex 53 | { 54 | if (anIndex == 0) 55 | { 56 | dismissed = YES; 57 | } 58 | } 59 | 60 | - (void)validateAndSaveCriticalApplicationData 61 | { 62 | 63 | } 64 | 65 | - (void)handleException:(NSException *)exception 66 | { 67 | [self validateAndSaveCriticalApplicationData]; 68 | 69 | UIAlertView *alert = 70 | [[[UIAlertView alloc] 71 | initWithTitle:NSLocalizedString(@"Unhandled exception", nil) 72 | message:[NSString stringWithFormat:NSLocalizedString( 73 | @"You can try to continue but the application may be unstable.\n\n" 74 | @"Debug details follow:\n%@\n%@", nil), 75 | [exception reason], 76 | [[exception userInfo] objectForKey:UncaughtExceptionHandlerAddressesKey]] 77 | delegate:self 78 | cancelButtonTitle:NSLocalizedString(@"Quit", nil) 79 | otherButtonTitles:NSLocalizedString(@"Continue", nil), nil] 80 | autorelease]; 81 | [alert show]; 82 | 83 | CFRunLoopRef runLoop = CFRunLoopGetCurrent(); 84 | CFArrayRef allModes = CFRunLoopCopyAllModes(runLoop); 85 | 86 | while (!dismissed) 87 | { 88 | for (NSString *mode in (NSArray *)allModes) 89 | { 90 | CFRunLoopRunInMode((CFStringRef)mode, 0.001, false); 91 | } 92 | } 93 | 94 | CFRelease(allModes); 95 | 96 | NSSetUncaughtExceptionHandler(NULL); 97 | signal(SIGABRT, SIG_DFL); 98 | signal(SIGILL, SIG_DFL); 99 | signal(SIGSEGV, SIG_DFL); 100 | signal(SIGFPE, SIG_DFL); 101 | signal(SIGBUS, SIG_DFL); 102 | signal(SIGPIPE, SIG_DFL); 103 | 104 | if ([[exception name] isEqual:UncaughtExceptionHandlerSignalExceptionName]) 105 | { 106 | kill(getpid(), [[[exception userInfo] objectForKey:UncaughtExceptionHandlerSignalKey] intValue]); 107 | } 108 | else 109 | { 110 | [exception raise]; 111 | } 112 | } 113 | 114 | @end 115 | 116 | void HandleException(NSException *exception) 117 | { 118 | int32_t exceptionCount = OSAtomicIncrement32(&UncaughtExceptionCount); 119 | if (exceptionCount > UncaughtExceptionMaximum) 120 | { 121 | return; 122 | } 123 | 124 | NSArray *callStack = [UncaughtExceptionHandler backtrace]; 125 | NSMutableDictionary *userInfo = 126 | [NSMutableDictionary dictionaryWithDictionary:[exception userInfo]]; 127 | [userInfo 128 | setObject:callStack 129 | forKey:UncaughtExceptionHandlerAddressesKey]; 130 | 131 | [[[[UncaughtExceptionHandler alloc] init] autorelease] 132 | performSelectorOnMainThread:@selector(handleException:) 133 | withObject: 134 | [NSException 135 | exceptionWithName:[exception name] 136 | reason:[exception reason] 137 | userInfo:userInfo] 138 | waitUntilDone:YES]; 139 | } 140 | 141 | void SignalHandler(int signal) 142 | { 143 | int32_t exceptionCount = OSAtomicIncrement32(&UncaughtExceptionCount); 144 | if (exceptionCount > UncaughtExceptionMaximum) 145 | { 146 | return; 147 | } 148 | 149 | NSMutableDictionary *userInfo = 150 | [NSMutableDictionary 151 | dictionaryWithObject:[NSNumber numberWithInt:signal] 152 | forKey:UncaughtExceptionHandlerSignalKey]; 153 | 154 | NSArray *callStack = [UncaughtExceptionHandler backtrace]; 155 | [userInfo 156 | setObject:callStack 157 | forKey:UncaughtExceptionHandlerAddressesKey]; 158 | 159 | [[[[UncaughtExceptionHandler alloc] init] autorelease] 160 | performSelectorOnMainThread:@selector(handleException:) 161 | withObject: 162 | [NSException 163 | exceptionWithName:UncaughtExceptionHandlerSignalExceptionName 164 | reason: 165 | [NSString stringWithFormat: 166 | NSLocalizedString(@"Signal %d was raised.", nil), 167 | signal] 168 | userInfo: 169 | [NSDictionary 170 | dictionaryWithObject:[NSNumber numberWithInt:signal] 171 | forKey:UncaughtExceptionHandlerSignalKey]] 172 | waitUntilDone:YES]; 173 | } 174 | 175 | void InstallUncaughtExceptionHandler(void) 176 | { 177 | NSSetUncaughtExceptionHandler(&HandleException); 178 | signal(SIGABRT, SignalHandler); 179 | signal(SIGILL, SignalHandler); 180 | signal(SIGSEGV, SignalHandler); 181 | signal(SIGFPE, SignalHandler); 182 | signal(SIGBUS, SignalHandler); 183 | signal(SIGPIPE, SignalHandler); 184 | } 185 | 186 | -------------------------------------------------------------------------------- /bengkui/bengkui/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // bengkui 4 | // 5 | // Created by rainbird on 12-8-31. 6 | // Copyright (c) 2012年 rainbird. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /bengkui/bengkui/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // bengkui 4 | // 5 | // Created by rainbird on 12-8-31. 6 | // Copyright (c) 2012年 rainbird. 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 | { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)viewDidUnload 24 | { 25 | [super viewDidUnload]; 26 | // Release any retained subviews of the main view. 27 | } 28 | 29 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 30 | { 31 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 32 | } 33 | 34 | - (IBAction)bengkui:(id)sender { 35 | [self performSelector:@selector(aaaa)]; 36 | } 37 | @end 38 | -------------------------------------------------------------------------------- /bengkui/bengkui/bengkui-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.cnrainbird.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /bengkui/bengkui/bengkui-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'bengkui' target in the 'bengkui' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /bengkui/bengkui/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /bengkui/bengkui/en.lproj/ViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1296 5 | 12B19 6 | 2549 7 | 1187 8 | 624.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1498 12 | 13 | 14 | IBProxyObject 15 | IBUIButton 16 | IBUIView 17 | 18 | 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | PluginDependencyRecalculationVersion 23 | 24 | 25 | 26 | 27 | IBFilesOwner 28 | IBCocoaTouchFramework 29 | 30 | 31 | IBFirstResponder 32 | IBCocoaTouchFramework 33 | 34 | 35 | 36 | 274 37 | 38 | 39 | 40 | 292 41 | {{118, 182}, {85, 37}} 42 | 43 | 44 | 45 | _NS:9 46 | NO 47 | IBCocoaTouchFramework 48 | 0 49 | 0 50 | 1 51 | 崩溃一个 52 | 53 | 3 54 | MQA 55 | 56 | 57 | 1 58 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 59 | 60 | 61 | 3 62 | MC41AA 63 | 64 | 65 | 2 66 | 15 67 | 68 | 69 | Helvetica-Bold 70 | 15 71 | 16 72 | 73 | 74 | 75 | {{0, 20}, {320, 460}} 76 | 77 | 78 | 79 | 80 | 3 81 | MC43NQA 82 | 83 | 2 84 | 85 | 86 | NO 87 | 88 | IBCocoaTouchFramework 89 | 90 | 91 | 92 | 93 | 94 | 95 | view 96 | 97 | 98 | 99 | 7 100 | 101 | 102 | 103 | bengkui: 104 | 105 | 106 | 7 107 | 108 | 9 109 | 110 | 111 | 112 | 113 | 114 | 0 115 | 116 | 117 | 118 | 119 | 120 | -1 121 | 122 | 123 | File's Owner 124 | 125 | 126 | -2 127 | 128 | 129 | 130 | 131 | 6 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 8 140 | 141 | 142 | 143 | 144 | 145 | 146 | ViewController 147 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 148 | UIResponder 149 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 150 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 151 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 152 | 153 | 154 | 155 | 156 | 157 | 9 158 | 159 | 160 | 161 | 162 | ViewController 163 | UIViewController 164 | 165 | bengkui: 166 | id 167 | 168 | 169 | bengkui: 170 | 171 | bengkui: 172 | id 173 | 174 | 175 | 176 | IBProjectSource 177 | ./Classes/ViewController.h 178 | 179 | 180 | 181 | 182 | 0 183 | IBCocoaTouchFramework 184 | 185 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 186 | 187 | 188 | YES 189 | 3 190 | 1498 191 | 192 | 193 | -------------------------------------------------------------------------------- /bengkui/bengkui/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // bengkui 4 | // 5 | // Created by rainbird on 12-8-31. 6 | // Copyright (c) 2012年 rainbird. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | --------------------------------------------------------------------------------