When debugging in Xcode 3.2 (Snow Leopard) the following code "works" but, sometime later, causes addressing exception in the apps run loop...
NSArray *filesToOpen, *fileTypes = [NSArray arrayWithObject: @"txt"];
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
NSString *fileToOpen;
const char *fileToRead = NULL;
[oPanel setAllowsMultipleSelection: NO];
[oPanel setResolvesAliases: YES];
[oPanel setTitle: @"IOSilver script file"];
if ([oPanel runModalForTypes: fileTypes] == NSOKButton) {
filesToOpen = [oPanel filenames];
fileToOpen = [filesToOpen objectAtIndex: 0];
fileToRead = [fileToOpen cStringUsingEncoding: NSASCIIStringEncoding];
[self constructScriptFromFileNamed: fileToOpen];
}
Further, when used without the debugger it causes all sorts of strange results regarding subsequent events such as keypresses.
Any comments or ideas as to what's up would be greatly appeciated.