我正在制作一个 osx 应用程序,它有一个按钮,可以将用户的背景设置为他们的屏幕保护程序。这是我的代码:
-(IBAction)startSaver:(id)sender {
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/usr/bin/open"];
NSArray *arguments;
arguments = [NSArray arrayWithObjects: @"-a", (@"/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background"), nil];
[task setArguments: arguments];
[task launch];
}
出于某种原因,我不断收到此错误:
FSPathMakeRef(/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background) failed with error -43.
请帮忙!!