launch-services

How to find multiple apps with same bundle identifier?

北城以北 提交于 2019-11-30 20:25:53
Does anyone know of a good way to find (in the filesystem) every app with a given bundle identifier? NSWorkspace and Launch Services let you look for an app by bundle identifier, but only return a single result. I suspect Spotlight ( NSMetadataQuery ) might help, but I'm a bit unclear on its API, so I'm not sure if there's an appropriate key. There's the command-line lsregister tool (inside LaunchServices.framework), which can be told to (re)register everything on the system and then dump a report on everything it knows about. Relying on that seems less than ideal, since it's undocumented and

List potential applications that could open a file

一个人想着一个人 提交于 2019-11-30 17:46:14
问题 Is it possible to get a list of applications installed on the users computer that could be used to open a file (in my case an image), similar to the list shown through the Finder's "Open With..." menu? 回答1: Are you looking for a programatic or scripting solution? Programatically, look at Launch Services ( LSCopyAllRoleHandlersForContentType() for instance). For scripting, you probably want lsregister which is buried down in /System/Library/Frameworks/CoreServices.framework/Versions/A

How to find multiple apps with same bundle identifier?

 ̄綄美尐妖づ 提交于 2019-11-30 04:55:29
问题 Does anyone know of a good way to find (in the filesystem) every app with a given bundle identifier? NSWorkspace and Launch Services let you look for an app by bundle identifier, but only return a single result. I suspect Spotlight ( NSMetadataQuery ) might help, but I'm a bit unclear on its API, so I'm not sure if there's an appropriate key. There's the command-line lsregister tool (inside LaunchServices.framework), which can be told to (re)register everything on the system and then dump a

Setting default application for given file extension on Mac OS X from code

非 Y 不嫁゛ 提交于 2019-11-28 19:56:55
I have the list of the applications for given file extension (using LSCopyApplicationURLsForURL). I want to change the default file association from code upon selecting one of the applications from the above call. Is there a way to do this? Here is a snippet of code for a very related task: set yourself as the default application for a given file extension: #import <ApplicationServices/ApplicationServices.h> #import "LaunchServicesWrapper.h" @implementation LaunchServicesWrapper + (NSString *) UTIforFileExtension:(NSString *) extension { NSString * UTIString = (NSString *

Enumerate All Installed Applications on OS X

偶尔善良 提交于 2019-11-28 08:44:36
Basic problem I'm looking for a solution to enumerate all applications installed on a (Mac) OS X system, i.e. all application bundles registered with LaunchServices . Simple approach that did not work (Please note: lsregister can be found under /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister ). Currently I am using the output of lsregister -dump | grep -E '^.*[ \\t]*path:[ \\t]+(\/.*)$' | grep -Eo '\/.*' , which has a few problems: .app bundles with newlines ( \n , which is valid on UNIX) are not handled correctly (This issue would be

Open URL with Safari no matter what system browser is set to

三世轮回 提交于 2019-11-27 13:56:09
问题 In my objective-c program, I need to open a URL in Safari no matter what the system's default browser is. That means that this won't work, because it could launch Firefox or whatever other browser: NSWorkspace * ws = [NSWorkspace sharedWorkspace]; [ws openURL: url]; I think I'm close with this: [ws launchAppWithBundleIdentifier: @"com.apple.Safari" options: NSWorkspaceLaunchWithoutActivation additionalEventParamDescriptor: NULL launchIdentifier: nil]; only need to figure out how to pass in

Setting default application for given file extension on Mac OS X from code

纵然是瞬间 提交于 2019-11-27 12:53:13
问题 I have the list of the applications for given file extension (using LSCopyApplicationURLsForURL). I want to change the default file association from code upon selecting one of the applications from the above call. Is there a way to do this? 回答1: Here is a snippet of code for a very related task: set yourself as the default application for a given file extension: #import <ApplicationServices/ApplicationServices.h> #import "LaunchServicesWrapper.h" @implementation LaunchServicesWrapper +

Why is my iOS app not showing up in other apps' “Open in” dialog?

佐手、 提交于 2019-11-27 10:32:16
I am trying to implement the registering process that allows my iOS app to show up in the "Open in" list of other applications (as described in Apple's Document Interaction Programming Topics ). I want my app to be able to handle audio from any app that will provide a standard audio file format (MP3, AIFF, WAV, etc.). As I understand it, all I should need to do is add the CFBundleDocumentTypes key, with relevant subdata, to my app's Info.plist. This is what I put in (via Xcode 4's Document Types editor): <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeIconFiles</key> <array>

Enumerate All Installed Applications on OS X

℡╲_俬逩灬. 提交于 2019-11-27 02:29:41
问题 Basic problem I'm looking for a solution to enumerate all applications installed on a (Mac) OS X system, i.e. all application bundles registered with LaunchServices. Simple approach that did not work (Please note: lsregister can be found under /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister ). Currently I am using the output of lsregister -dump | grep -E '^.*[ \\t]*path:[ \\t]+(\/.*)$' | grep -Eo '\/.*' , which has a few problems: .app

Why is my iOS app not showing up in other apps&#39; “Open in” dialog?

我们两清 提交于 2019-11-26 15:14:11
问题 I am trying to implement the registering process that allows my iOS app to show up in the "Open in" list of other applications (as described in Apple's Document Interaction Programming Topics). I want my app to be able to handle audio from any app that will provide a standard audio file format (MP3, AIFF, WAV, etc.). As I understand it, all I should need to do is add the CFBundleDocumentTypes key, with relevant subdata, to my app's Info.plist. This is what I put in (via Xcode 4's Document