macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

URLForApplicationWithBundleIdentifier:

INDEX>AppKit>NSWorkspace

バンドルIDからURLを返します。

Objective-C

- (NSURL *)URLForApplicationWithBundleIdentifier:(NSString *)bundleIdentifier

Swift

func URLForApplicationWithBundleIdentifier(_ bundleIdentifier: String) -> NSURL?

解説

バンドルIDからURLを返します。

返り値

Objective-C

NSURL *

Swift

NSURL?

引数

Objective-C

(NSString *)bundleIdentifier

Swift

_ bundleIdentifier: String

フレームワーク

ApplicationKit

クラス

NSWorkspace

使用可能

10.6-

更新時のバージョン

OS X 10.10.3
Swift1.2

参照

関連記事(外部サイト)

例文

Objective-C

Swift

    //NSWorkspace URLForApplicationWithBundleIdentifier
    @IBAction func function022(sender: AnyObject) {
        let theWorkspace : NSWorkspace = NSWorkspace.sharedWorkspace()
        let theURL : NSURL = theWorkspace.URLForApplicationWithBundleIdentifier("com.apple.safari")!
    
        NSLog("%@", theURL.description)
        //file:///Applications/Safari.app/
    }