Cocoa 菜单栏代理应用程序带有助手 cocoa 应用程序并从主 cocoa 应用程序触发,它在无响应中消失了
Cocoa Menu Bar Agent app With a Helper cocoa app and triggered ON from Main cocoa app, its Gone in NOT RESPONDING
我正在制作一个 Cocoa 菜单栏代理 app.now 问题是 Cocoa 主应用程序引用另一个助手应用程序,我使用 NSBundle 和 Workspace 通过以下方式启动这个助手应用程序主应用程序在正常工作后 2 分钟内处于无响应状态(ON|OFF)Button.Gone。
在这种情况下,我们如何才能做到这一点。
助手应用程序只是被拖到主应用程序中。
ON 按钮->
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *helperAppPath = [[mainBundle bundlePath]
stringByAppendingString:@"/Contents/Resources/helperapp.app"];
[[NSWorkspace sharedWorkspace] launchApplication:helperAppPath];
Q.which 权利必须设置或在哪个应用程序中设置?
Q.Save 它来自崩溃(无响应)。
IMP Question is that -> .Note that NoW i watched at activity monitor there is showing debugserver919, in Parent Process. instead of launched1 tell me what i can do?
已实施答案
上面提到的代码用于低于 MacOS 10.6 的系统
对于 10.6 及更高版本,我们可以使用代码
- (void)launchApplicationWithPath:(NSString *)path
{
// As recommended for OS X >= 10.6.
[[NSWorkspace sharedWorkspace] respondsToSelector:@selector(launchApplicationAtURL:options:configuration:error:)];
[[NSWorkspace sharedWorkspace] launchApplicationAtURL:[NSURL fileURLWithPath:path isDirectory:NO] options:NSWorkspaceLaunchDefault configuration:nil error:NULL];
// For older systems.
// return [[NSWorkspace sharedWorkspace] launchApplication:path];
}
以及如何调用此方法:
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *helperAppPath = [[mainBundle bundlePath]
stringByAppendingString:@"/Contents/Resources/helper.app"];
[self launchApplicationWithPath:helperAppPath];
通过此代码,您的助手应用程序可以很好地启动,并且不会在没有响应的情况下消失,谢谢欢迎。
我正在制作一个 Cocoa 菜单栏代理 app.now 问题是 Cocoa 主应用程序引用另一个助手应用程序,我使用 NSBundle 和 Workspace 通过以下方式启动这个助手应用程序主应用程序在正常工作后 2 分钟内处于无响应状态(ON|OFF)Button.Gone。 在这种情况下,我们如何才能做到这一点。 助手应用程序只是被拖到主应用程序中。
ON 按钮->
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *helperAppPath = [[mainBundle bundlePath]
stringByAppendingString:@"/Contents/Resources/helperapp.app"];
[[NSWorkspace sharedWorkspace] launchApplication:helperAppPath];
Q.which 权利必须设置或在哪个应用程序中设置? Q.Save 它来自崩溃(无响应)。
IMP Question is that -> .Note that NoW i watched at activity monitor there is showing debugserver919, in Parent Process. instead of launched1 tell me what i can do?
已实施答案 上面提到的代码用于低于 MacOS 10.6 的系统 对于 10.6 及更高版本,我们可以使用代码
- (void)launchApplicationWithPath:(NSString *)path
{
// As recommended for OS X >= 10.6.
[[NSWorkspace sharedWorkspace] respondsToSelector:@selector(launchApplicationAtURL:options:configuration:error:)];
[[NSWorkspace sharedWorkspace] launchApplicationAtURL:[NSURL fileURLWithPath:path isDirectory:NO] options:NSWorkspaceLaunchDefault configuration:nil error:NULL];
// For older systems.
// return [[NSWorkspace sharedWorkspace] launchApplication:path];
}
以及如何调用此方法:
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *helperAppPath = [[mainBundle bundlePath]
stringByAppendingString:@"/Contents/Resources/helper.app"];
[self launchApplicationWithPath:helperAppPath];
通过此代码,您的助手应用程序可以很好地启动,并且不会在没有响应的情况下消失,谢谢欢迎。