0
@implementation button
- (IBAction)doSomething:(id)pId;
{
NSFileManager *filemgr;
NSString *currentpath;
NSString *appPath;
filemgr = [[NSFileManager alloc] init];
currentpath = [filemgr currentDirectoryPath];
appPath=[currentpath stringByAppendingString:@"/resources/systemRun.app"];
[[NSWorkspace sharedWorkspace] openFile:appPath withApplication:nil];
exit(0);
}
@end
作品此代碼工作完全當我建立&運行在Xcode,或當我右鍵單擊「產品」從在Xcode。然而,當我從finder運行應用程序它永遠不會啓動......即使從非常建立的文件夾.. wtf?NSWorkspace lauchApplication怪事 - 它只是從在Xcode