崩潰我在這樣的頭文件設置好的NSString *oldChat
:應用與EXC_BAD_ACCESS上背景
@interface CTFChatViewController : UIViewController {
NSString *oldChat;
}
- (void)updateChat;
@property (nonatomic, retain) NSString *oldChat;
@end
,然後我使用它:
- (void)updateChat
{
NSString *chat = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://theshay.byethost7.com/chat.php"] encoding:NSUTF8StringEncoding error:nil];
if (![chat isEqual:oldChat])
{
[webView loadHTMLString:chat baseURL:nil];
oldChat = chat;
}
[self performSelectorInBackground:@selector(updateChat) withObject:nil];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
NSString *chat = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://theshay.byethost7.com/chat.php"] encoding:NSUTF8StringEncoding error:nil];
oldChat = chat;
[webView loadHTMLString:chat baseURL:nil];
[self performSelectorInBackground:@selector(updateChat) withObject:nil];
}
應用墜毀if (![chat isEqual:oldChat])
與EXC_BAD_ACCESS
錯誤。 它爲什麼墜毀?
(的XCode 4.5.2,iPhone模擬器6.0 SDK基地6.0)
如果你不打算使用它,你爲什麼要創造oldChat的財產? – 2013-02-22 12:30:51