您如何在登录时打开您的应用程序? [英] How do you make your App open at login?

查看:36
本文介绍了您如何在登录时打开您的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道如何让我的应用在登录时自动打开,但可以使用首选项窗口中的复选框打开和关闭.

Just wondering how I can make my app open automatically at login, but make this be able to be toggled on and off using a check box in the preferences window.

推荐答案

CocoaDev.

基本上,如果您可以面向 Mac OS X 10.5 或更高版本,您将需要使用 LaunchServices/LSSharedFileList.h 中的 API.在 10.5 之前没有干净的 API,所以你必须手动操作登录项(开发人员连接处的示例代码).

Basically, you'll want to use the API in LaunchServices/LSSharedFileList.h if you can target Mac OS X 10.5 or later. Before 10.5 there was no clean API, so you have to manually manipulate the login items (Sample code at the Developer Connectiong).

这是示例代码(dead) 对于 Leopard 我在评论中提到过.通过 这篇博文.您需要在登录时启用或禁用启动的代码位于 Controller.m 中.

Here's the sample code(dead) for Leopard I mentioned in the comments. Found via this blog post. The code you need to enable or disable startup at login is in Controller.m.

这篇关于您如何在登录时打开您的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆