This code crashes with SIGABRT:
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel runModalForTypes:nil];
NSArray* URLs = [openPanel URLs];
for (NSString* item in URLs)
{
NSLog(item); // here it crashes with SIGABRT
}
I don’t see anything wrong with the code but I’m a beginner at Objective-C.
Try doing
for (NSURL *url in URLs)instead. For some reason, you are incorrectly using anNSString.Also, you should be logging like this:
NSLog(@"%@", url);This is the way you should do it. You shouldn’t be passing the object directly toNSLog.