當我使用模擬器在Xcode中運行我的應用程序時,它只運行文件,直到我在涉及文本文件的前三行中添加爲止。它給了我一個消息terminate called after throwing an instance of 'NSException'.
我不知道這意味着什麼,或者爲什麼只有當我嘗試讀取文本文件並將其顯示在textView中時纔會發生。當我運行應用程序時xcode調試終止
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"textfiles/brain_01" ofType:@"txt"];//establish file path for text file
NSString *textFile = [[NSString alloc] stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error: nil];
textView.text = textFile;
[super viewDidLoad];
fullButton.hidden = YES;
viewLabel.hidden = YES;
}
謝謝! 這正是問題所在。 – ebeth