How to implement a check for update on Mac OS X - objective-c

I'm trying to create an internal app for my company. I want to provide some kind of "automatic update" feature that give the user a message (with install option) once a new version is available. I know that for windows there is a technology named ClickOnce. Is there some kind of standard implementation for mac os x? Should I write it from scratch? If so, how can I start the install process directly from my application? Should I provide a mpkg?

Sparkle is probably what you want. It's used in many apps and is probably the "norm" of actual automatic update nowadays in mac apps other than the app store itself.

Related

Launch my Mac app in case other Mac app was launched

I need to write Mac app which will start automatically only in case when another particular app was launched. Could you please provide entry point where to look and what to use. Do I need to have special autostart up process? I am new to Mac app development.
You can add observer using CFNotificationCenterGetDistributedCenter() for example.
Please, take a look at this article, here may be the solution Inter-process communication

Monitor User App Usage From Mac OS X App

I am interested in building a Mac OS X application that requires knowing what applications the user has open and when a new one opens, all when my app is running. It doesn't have to be approved by the Mac App Store (If this violates their use terms). An example of an app that does this is the Rescue Time app.
Thank you for any answers,
Michael Truell
Don't know if you're still trying to needs this, but I did some more research on how to solve this and here is what you could look into:
To get notified when applications are opened by a user, use NSWorkspace's notification center, and add an observer for keys like NSWorkspaceDidActivateApplicationNotification. See the documentation NSWorkspace. You can also use NSWorkspace to get all running applications.
If you need to access information about a running application, you should check out Scripting Bridge, and if you don't care about App Store or sandboxing, check you accessibility api, AX

need a way to securely communicate between Priviliged Helper Tool (installed using SMJobBless) and the application

I am trying to install a privileged helper tool to perform some elevated work. I am using SMJobBless for the same.
I am able to install the tool fine and also able to communicate with it. I am using Mac OS X 10.8.4 and using NSXPCConnection for the same.
I have added .mach service in the plist which will be installed in /Library/LaunchDaemons. I am using [initWithMachServiceName:options:] in the app as the helper is privileged tool and [– initWithMachServiceName:] in the helper to listen. The communication is working fine.
But the problem is I tried the same communication with another application I created which did not have any codesign at all (the helper tool installer earlier was codesigned). I tried to connect to the mach service of the helper tool and was able to connect easily. This is a problem because anybody can communicate with it then and make it do anything.
I wanted some way to securely communicate between my application and the helper tool.
Thanks a lot.
As you've said that you're not signing the second app, I believe that that is the problem that is allowing a 2nd app from calling the helper application. From the Apple docs and specifically the ReadMe file in SMJobBless, it states: -
The Service Management framework uses code signatures to ensure that the helper tool is the one expected to be run by the main application
This document should be able to assist you in getting the helper app correctly associated with its owner.
Note that it references a python script, which is provided here.
Answering my own question: I had logged a radar bug for the same and Apple said that the behavior was intended:
"It is up to the privileged helper to not expose insecure operations"

How can I make a Mac App Store app check for updates?

Within my app, how can I make it check if there is an update available in the Mac App Store, and tell the user about this?
As an example, Sparrow does this.
Charcoal Design has an open source component that does that: iVersion.
But it requires you to add a file in your server for your application to read.
Whenever you update the version, just change the information in your server, and iVersion will show the user that a new version is available.
You could also scrape Apple's servers to read the version of your app, but there is chance that your app may be rejected for doing that.
Basically, Sparrow does not need to ask the App Store. It can just compare its bundle string to the newest version on their website.

Is Adobe AIR a good choice for building an app usage-monitoring tool?

I've been looking for some some answers about Adobe AIR in its current version and I'm wondering if any of you could let me know if I can do all these things with an Adobe AIR app, since I know they have their limitations:
Sit in the system tray in Windows and as a small icon in the top-most bar in OS X while running in the background? Will this require different programming to support both platforms?
While being in the background, be notified of which app gets the focus and when? Ideally, I would also get the name of the document, URL of the website (if we're on a browser with tabs) that has the focus, etc. I'm trying to build a tool similar to RescueTime, that tells you how much time you spent on each app or website.
Have a specific system-wide hotkey (like Alt+Space) that when pressed, the app comes up into focus (from being in the background)?
Show notifications (Growl-style unintrusive popups) for specific events?
Being notified when the system gets inactive (screensaver pops up, users "sleeps" computer, etc)
Thanks!
yes. all of that can be accomplished with and AIR application using NativeApplication and NativeProcess.
in order to write once and deploy on Windows and Mac, you will need to determine which OS your application is running either by employing the NativeApplication properties:
NativeApplication.supportsDockIcon (Mac OS X)
NativeApplication.supportsSystemTrayIcon (Windows)
or you can determine the OS more precisely like this:
//Resoslve Operating System
if (Capabilities.os.toLowerCase().indexOf("win") > -1)
{
//Native Processes for Windows
}
else if (Capabilities.os.toLowerCase().indexOf("mac") > -1)
{
//Native Processes for Mac OS X
}
else if (Capabilities.os.toLowerCase().indexOf("linux") > -1)
{
//Native Process for Linux
}
else
{
throw new Error("Unresolved Operating System");
}
while this approach will only require you to write the application once, AIR applications that use system specific processes (Native Processes) must be published with native installers for each target OS as those native processes are different for each OS.
some native processes (such as reading data from a serial port or printer driver) may require a small, helper application, perhaps written in C++, to be used as a proxy that is controlled by AIR for communication between AIR and the target process.
further reading: Interacting with a native process
Yes, system tray is supported in unified way
No, AIR has no knowledge of other applications.
No global hotkey support
Yes
No
AIR isn't created with system programming in mind, it has web roots. Items 2, 3 and 5 could be done with native helper, but this require system programming for each target platform.