Referring to an NSString in output of UIAlertView?
问题 I have an NSString , testString which is set to a value in my app. Then as a response to a button press in UIAlertView I have the following code: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { NSLog(@"String: %@", testString); } } But for sme reason, this always causes the app to crash. I can't seem to figure out why. 回答1: Probably you create your string with one of convenience methods and don't retain it, so when it comes to