我的應用程序崩潰中經常死機這個for循環:應用在for循環常常
for (int a = 0; a <= 20; a++) {
NSString * foo = [[NSString alloc]initWithString:[[newsStories objectAtIndex:arc4random() % [newsStories count]] objectForKey:@"title"]];
foo = [foo stringByReplacingOccurrencesOfString:@"’" withString:@""];
foo = [[foo componentsSeparatedByCharactersInSet:[[NSCharacterSet letterCharacterSet] invertedSet]] componentsJoinedByString:@" "];
foo = [foo stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
textView.text = [textView.text stringByAppendingString:[NSString stringWithFormat:@"%@ ", foo]];
}
的代碼放入NSDictionary改變的NSString並將其添加到一個TextView。有時它會在第二次使用for循環時崩潰。我錯了什麼?
你會發生什麼事故? – 2010-03-22 02:48:29
NSLog中沒有崩潰消息。 – Flocked 2010-03-22 02:49:54
什麼是崩潰?它說什麼?不在NSLog中,但在調試器中。 – Chuck 2010-03-22 02:51:18