How to control "Prevent App Nap" being displayed in applications "Get Info"? - macos

When I right click on my OSX application and select "Get Info", the "Prevent App Nap" option is not there. How does one control this in Xcode or programmatically? I certainly don't remember doing anything to remove it.
I could not find anything relevant in the Apple Docs or searching online beyond users asking why a particular application did not have "Prevent App Nap" as an option. So how does a developer control that?
Or does this mean that App Nap is already disabled?

I'm not entirely sure, but it might have something to do with the base SDK used to build the application. I can build my app with a base SDK of 10.5, and for that version of the app the "Prevent App Nap" checkbox appears in Get Info. If I build the same app with a base SDK of 10.10, the "Prevent App Nap" checkbox does not appear. This is only an observation, I have not found any Apple doc that says that is actually their policy.
I’ve noticed that some applications on my 10.10.3 system do not include the “Prevent App Nap” checkbox, and some do. I thought it might be related to manually adding the NSAppSleepDisabled setting to the application plist, but that does not seem to be the case. For example, Firefox.app 38.0.5 does show the Prevent App Nap checkbox, as well as iMovie.app, but iPhoto.app and ITunes.app do not.

Related

Why can I run my signed Safari App Extension on other computers, but not the one I developed it on?

I’ve started a Safari App Extension project, following Apple’s documentation.
I’ve got my (empty) app, and my very minimal extension. I’ve archived the app, signing it with my Developer ID. When I copied the archived app to a friend’s Mac, ran it, and launched Safari, the app extension showed up in the Extensions pane of Safari’s preferences (with the parent app’s icon), and when enabled, worked fine.
However, when I run the app on my Mac (where I developed it), and launch Safari, the app extension does not show up in Safari’s Extensions preference pane unless I check “Allow Unsigned Exceptions” in Safari’s develop menu, as described in this answer — and when it does, it has a generic app icon, rather the parent app’s icon.
Although I hope to eventually make the app and the app extension available to other people, I’m mainly making it for myself. As such, I’d like to be able to use it without having to check “Allow Unsigned Exceptions” every time I start Safari.
How can I make the app extension show up in Safari’s Extensions preference pane on the computer I develop the extension on?
I found a debug version of my app and app extension in my user Library folder:
~/Library/Developer/XCode/DerivedData/{APP_NAME_FOLLOWED_BY_LONG_STRING}/Build/Products/Debug
After deleting the contents of this folder, restarting Safari, and allowing unsigned extensions again, my app extension no longer appeared with the generic icon in Safari’s Extensions preferences.
(I’m a real Xcode newbie, so I’ve no idea if deleting debug builds is a thing that I can/should do via Xcode instead.)
I then archived my app again and ran it, then restarted Safari. Now my app extension shows up in Safari’s Extensions preferences, with its proper icon and everything, and stays enabled between restarts.

Accessibility disabled for app in Mac OS X 10.9

After upgrading to Mac OS X 10.9 and running my app (which executes various AppleScripts as part of its execution) I get a dialog that the app has to be specifically enabled via the System Preferences Security/Privacy screen. So I do this and the app then functions properly.
However, when I recompile and build the app, it will no longer execute the AppleScripts and does not show the dialog. When I look in the System Preferences Security/Privacy I see that my app is still listed there but has been disabled (i.e. checkbox reset).
BY trial and error, I have found the following:
If you change the Bundle Version string in the apps info.plist and rebuild the app even without making any other changes such as code, etc this will happen; it will be disabled from accessibility.
If you make all kinds of changes to the app (code, resources, etc) but do not change the Bundle Version string in info.plist, it will still be allowed to have accessibility access.
My question is: is there a way to circumvent disabling after rebuilding?

Creating feature in mac app to override the users security setting

I'm a newbie at mac osx development. I would like to know if there's any way to override the mac desktop security settings to allow an application - which is not registered in the Mac App Store, to be installed?
The setting should come from the app that I'm trying to install. That means, whenever I install the app to any mac computer, regardless of its security settings as the following,
Allow applications downloaded from:
Mac App Store
Mac App Store and identified developers
Anywhere
The app should set the settings to Anywhere, allowing it to be installed.
Any help would be very much appreciated.
Launch System Preferences from the Apple menu.
Choose “Security & Privacy” and then click the “General” tab, followed by clicking the lock icon in the corner to unlock the settings.
Look for “Allow applications downloaded from:” and choose “Anywhere”.
Accept the security warning and allow.
Note that you should be careful and aware that now the job of protecting the system from malicious apps belongs to you instead of the OS.
Right click the (app) icon and click 'open' in contextual menu - no need to disable the OS security.
This is not possible. The existence of that setting is intended to protect users from malicious executables. If there were a way for any arbitrary executable to override that setting, what protection would it offer? Malicious executables would simply change the setting to "Anywhere" like you suggest, bypassing the security features of Mac OS X.
You need to sign your application using a Mac Developer certificate, which you can obtain from Apple. That will mark your app as built by an "identified developer" and it will launch just fine without changing any settings.
Control Click the app icon to override this security feature. This is a one off, you don't have to change your settings, you can do it per-app.
There is one other way...
All you have to do to do it manually is to open up Terminal, cd into the .app application, cd into the Contents folder, then cd into the MacOS folder, then type ./YourAppNameHere and execute by typing Enter.

XCode won't let me change my login details

Xcode states.
xxxx#gmail.com is not a Registered Apple Developer.
This is really annoying, as I have a registered account, I just typed the wrong one. How to I get another opportunity to login.
Delete all the documentation links in that preference pane and then click on "check & install now" button again.
That should bring you back to the login dialog.
Instructions from this similiar question might work, they just did for me:
How can I change the Apple ID that Xcode 4 uses to download components?
It seems it's better to download Xcode directly from Member Center (not trough the Mac App Store).

Download of Cocoa API documentation

Is it possible to download all Cocoa API documentation? I have to work offline a lot of times and sometimes a doubt blocks all my work...
Xcode does this for you automatically, unless you've disabled it ?
Your Documentation prefs pane should look something like this:
Note that in the above case there are 4 documentation sets installed and the remaining uninstalled sets can be installed by hitting the associated Get buttons. Once you have the required documentation installed then it's available via the Help => Developer Documentation menu, even when you are off-line.
As #PaulR mentions, Xcode does this automatically. Look in the Documentation preferences. If there's no button called "Get" next in the "Mac OS X 10.6 Core Library" row, then it's already downloaded and installed.
If you still don't think it's working, then check out Ingredients.app. It's an offline documentation browser. It's pretty nice. :)

Resources