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

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

问题描述

只是想知道如何让我的应用程序在登录时自动打开,但使其能够在首选项窗口中的复选框打开和关闭。

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

基本上,如果您可以定位到LaunchServices / LSSharedFileList.h, Mac OS X 10.5或更高版本。在10.5之前没有干净的API,所以你必须手动操作登录项(在Developer Connectiong上的示例代码)。

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)对于我在评论中提到的。通过这篇博文。您需要在登录时启用或禁用启动的代码在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天全站免登陆