@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 ?