开发者

How to terminate cocoa app in applicationWillFinishLaunching delegate

开发者 https://www.devze.com 2023-01-02 03:56 出处:网络
I have to s开发者_开发知识库how the custom license Agreement dialog to the user before they start using my application.So, I have added new window in my mainMenu.xib and showing that window modally us

I have to s开发者_开发知识库how the custom license Agreement dialog to the user before they start using my application.So, I have added new window in my mainMenu.xib and showing that window modally using

[NSApp runModalForWindow:licenseWindow];

in applicationWillFinishLaunching: delegate by making my main window hidden using visible at Launch to unchecked. License window has two buttons Agree and Disagree. I need to show the mainwindow if user clicks on Agree button and terminate the app if they choose Disagree.

I try to call [NSApp terminate]; in applicationWillFinishLaunching: but it didn't do anything.

Please let me know how I can terminate the app in applicationWillFinishLaunching:

Thanks


Sorry I found the solution myself. It was my mistake, I need to call [NSApp terminate:nil]; instead of [NSApp terminate]; and now I am able to terminate my app normally as needed.

0

精彩评论

暂无评论...
验证码 换一张
取 消