Search code examples
objective-citunesterminate

Objective-C using NSRunningApplication terminate, to quit iTunes


I want to quit iTunes from my app, this is the code i have so far, but i get the error NSRunningApplication -undeclared.

if ([closeiTunes state] == NSOnState) {
    [[NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.iTunes"] objectAtIndex:0] terminate];
}

Can anyone help? Thanks.


Solution

  • NSRunningApplication is a class that is only available in the 10.6 SDK. Set the Base SDK to Mac OS X 10.6 and there should be no problems.