????????BUG????????????????а????????????????С??????????BUG???????
????1??Crash???
????2?????Crash???
?????????????????????У??????????BUG??Crash???????????????????????????????Crash??Bug???檔?????????Crash???BUG???????й???????????????????????Щ????????????“???”????????Щ???Crash???BUG????????????????OpenSSL???????????????????????????????????
??????κ????????BUG
????Crash???BUG???ó?????????????????????????????????????????????????????????Crash???Bug?????????????????????α???????????????????????????????????????????????????????????????ú??????crash?????????????????????????????????????????????????OpenSSL??????????????????????“?????????”??
????Crash?????£????μ?????????Crash???????????????????????£??????????????????????????Σ??????????????
?????????????ó???Crash???????????Crash?????????л??????????????????????Crash?????п?????????????????????????????????“BUG”????????????????????????????Crash??BUG?????????Crash??BUG??????п???????Crash???Bug?????Crash??BUG?????????
????NSAssert
??????????????????????????????“????”???????assertion???????????????????ó???????????????????????????????????????????????棬?????????????????????????????????ζ?????????????з?????????????????????????????????????????????????????????á???????????????????????е????????????????ó??????????Crash???????????????????????????
?????????????“????????”????????Ρ??????????????????????????ò?????????????????????????????????????????????????????????????????????????????????????????Χ????????????Ч??????????????????????????????????????????????????????檔
??????????????????????ο?????????2????“????????”???????????????????????????????
????1???????????????????????????????????????????????÷??????????
????2????????????е????????????
????3???????????????????????????
????4??????????????????????????????????
????5???????????????????????????????????????????????????????????????????????????????????????? ????IOS????У???????????NSAssert?????????????磺
????- (void)printMyName:(NSString *)myName
????{
????NSAssert(myName == nil?? @"???????????");
????NSLog(@"My name is %@."??myName);
????}
???????????myName?????????????????????NSAssert????????????????????????????????г????????????ó???Crash???
??????????????????????????????????NSAssertionHanlder????????????????????????????????????????????????????????????????????????NSInternalInconsistencyException????????????Crash????????????????????????????handleFailureInMethod:object:file:lineNumber:description:???????????????
???????????????????????????????????????????ó??????????????Crash??ɡ????????????????????????????assert ????release?汾????????NS_BLOCK_ASSERTIONS???????Ч??
??????????????Try-Catch
???????????Try-Catch?????????????????á????????????????У????????????Try-Catch??????????????????????????С?????????????????GOTO??á???????????д????Catch?С????????????????????????ifelse???
???????????????????????????????????г????????????????????????????????????????????????????????????????????????ú????????????????????????£?????????????????Crash???ó????????????????????????
????????IOS????У????????????????????????????????????????????????????????????NSError?????????
????- (void) doSomething:(NSError* __autoreleasing*)error
????{
????...
????if(error != NULL)
????{
????*error = [NSError new];
????}
????....
????}
???????????????????????????????????IOS????о?????????Try-Catch??
??????PS???????????Try-Catch?????????Crash???????????????????????????????????????
?????????????Crash???BUG??????Crash??
???????????????????????Crash??“BUG”??????????????“BUG”?????????????????Crash???“BUG”??????Crash????????б??????????????????ɡ?????д?Щ????????????????????????Щ?????????BUG?????????Crash????crash??????????????????
???????????????ó???“????”????????????????????
??????β???BUG
???????????BUG?????????е??????????BUG??????????????????????????????????????BUG??????????????????BUG??????????????????ü???????????????????BUG????????????BUG???????????????????????????????????????У??????Щ??BUG??????????????????????????????????
??????????BUG??????????????У?
????????????裬??????????????????
????????????????????BUG???????????з?????????????????BUG????????????????????????????????????????????BUG???????????? ???????????μ?????????????????????
?????????????
?????????BUG??????????????????
????1??????????????????
????2??????????????OS????????????? ???????????????????????????????????????????????email??????????????????????????????IOS????framework?????category?????????????????????????н?????
????????????????μ??3?????????????99.999999%??????????????????????????????????
??????????????????????????λ??????
?????????????????????????????????????BUG????????????????????????????BUG????????????????BUG?????????????????????
??????????????????IOS????????????????????????????????IOS????????????????????
???????????????????????????????????????????????????????????????????
????//array.count = 9
????for (int i = 100; array.count - (unsigned int)i > 10 ; )
????{
????i++
????.....
????}
???????????????????????????????е?????????????е????????????????????????????????????????????????o????array.count???????NSUInterge???????????????????????????????????????????????????????????????