IOS里面有些看起来是那么回事,想起来也是那么回事,结果不是那么回事的事。
1.crash?##
代码片段1
NSString *string = @"123"; [string release]; string = @"456";//crash?
代码片段2
NSObject *object = [[NSObject alloc] init]; [object release]; [object doSomething];//crash?
代码片段3
- (void)setupSomething { self.object = [[NSObject alloc] init]; [self.object release]; [self doSomething]; } - (void)doSomething { [self.object doSomething];//crash? }
2.equal?##
NSString *str1 = @"123"; NSString *str2 = @"123"; BOOL eq1 = (str1 == str2); //NO? BOOL eq2 = [Str1 isEqual:str2];//YES? BOOL eq3 = [str1 isEqualToString:str2];//YES?
3.MD5?##
MD5加密?