読者です 読者をやめる 読者になる 読者になる

Cocoa API解説(macOS/iOS)

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。

目次

runningApplications

INDEX>AppKit>NSWorkspace

実行中のアプリケーションを返します

Objective-C

@property(readonly, copy) NSArray *runningApplications

Swift

var runningApplications: [AnyObject] { get }

解説

実行中のアプリケーションを返します

返り値

Objective-C

@property(readonly, copy) NSArray *runningApplications

Swift

var runningApplications: [AnyObject] { get }

フレームワーク

ApplicationKit

クラス

NSWorkspace

使用可能

10.6-

更新時のバージョン

OS X 10.10.3
Swift1.2

参照

関連記事(外部サイト)

例文

Objective-C

Swift

    //NSWorkspace runningApplications
    @IBAction func function028(sender: AnyObject) {
        let theWorkspace : NSWorkspace = NSWorkspace.sharedWorkspace()
        
        NSLog("%@",(theWorkspace.runningApplications))
        //->
//        (
//        "<NSRunningApplication: 0x6000001015f0 (com.apple.loginwindow - 97)>",
//        "<NSRunningApplication: 0x6000001017a0 (com.trendmicro.iTIS.UIMgmt - 253)>",
//        "<NSRunningApplication: 0x6000001018c0 (com.google.inputmethod.Japanese - 353)>",
//        "<NSRunningApplication: 0x600000100f30 (.inputmethod.Japanese.Renderer - 358)>",
//        "<NSRunningApplication: 0x600000101200 ((null) - -1)>",
//        "<NSRunningApplication: 0x600000101050 (com.apple.systemuiserver - 471)>",
//        "<NSRunningApplication: 0x600000101170 (com.apple.dock - 469)>",
//        "<NSRunningApplication: 0x600000100fc0 (com.apple.Spotlight - 475)>",
//        "<NSRunningApplication: 0x600000101320 (com.apple.finder - 472)>",
//        "<NSRunningApplication: 0x6000001010e0 (com.apple.sharingd - 480)>",
//        "<NSRunningApplication: 0x600000101290 (com.apple.dock.extra - 485)>",
//        "<NSRunningApplication: 0x6000001013b0 (com.apple.iTunesHelper - 513)>",
//        "<NSRunningApplication: 0x600000100870 (com.apple.TISwitcher - 514)>",
//        "<NSRunningApplication: 0x600000100cf0 (com.security.apple.Keychain-Circle-Notification - 497)>",
//        "<NSRunningApplication: 0x600000100990 (com.apple.notificationcenterui - 500)>",
//        "<NSRunningApplication: 0x600000100b40 (jp.co.fenrir.sleipnir-helper - 515)>",
//        "<NSRunningApplication: 0x600000100bd0 (com.apple.photostream-agent - 506)>",
//        "<NSRunningApplication: 0x600000100900 (com.getdropbox.dropbox - 517)>",
//        "<NSRunningApplication: 0x600000100e10 (com.apple.wifi.WiFiAgent - 509)>",
//        "<NSRunningApplication: 0x600000100ab0 (com.apple.storeuid - 493)>",
//        "<NSRunningApplication: 0x600000100d80 (com.shapeservices.idisplay-host-lite - 536)>",
//        "<NSRunningApplication: 0x600000100a20 (com.apple.lateragent - 578)>",
//        "<NSRunningApplication: 0x600000100c60 (com.getdropbox.dropbox.garcon - 608)>",
//        "<NSRunningApplication: 0x600000100ea0 (com.apple.ImageCaptureExtension2 - 626)>",
//        "<NSRunningApplication: 0x6000001001b0 (com.apple.dt.Xcode - 1148)>",
//        "<NSRunningApplication: 0x600000100240 (com.apple.Safari - 1549)>",
//        "<NSRunningApplication: 0x6000001002d0 (com.apple.WebKit.Networking - 1552)>",
//        "<NSRunningApplication: 0x600000100480 (com.apple.WebKit.WebContent - 1555)>",
//        "<NSRunningApplication: 0x600000100630 (com.apple.WebKit.WebContent - 1556)>",
//        "<NSRunningApplication: 0x6000001003f0 (com.apple.WebKit.WebContent - 1558)>",
//        "<NSRunningApplication: 0x600000100510 (com.apple.qtkitserver - 1573)>",
//        "<NSRunningApplication: 0x600000100360 (com.apple.TextEdit - 2344)>",
//        "<NSRunningApplication: 0x6000001005a0 (com.getdropbox.dropbox.garcon - 2673)>",
//        "<NSRunningApplication: 0x6000001006c0 (com.apple.mail - 7902)>",
//        "<NSRunningApplication: 0x600000100750 (com.apple.WebKit.WebContent - 7928)>",
//        "<NSRunningApplication: 0x6000001007e0 (com.apple.WebKit.WebContent - 7929)>",
//        "<NSRunningApplication: 0x600000103060 (com.apple.LookupViewService - 8461)>",
//        "<NSRunningApplication: 0x6000001030f0 (com.apple.WebKit.WebContent - 11702)>",
//        "<NSRunningApplication: 0x600000104260 (com.apple.WebKit.WebContent - 11703)>",
//        "<NSRunningApplication: 0x600000104380 (com.apple.qtkitserver - 11706)>",
//        "<NSRunningApplication: 0x600000104410 (com.apple.WebKit.WebContent - 12430)>",
//        "<NSRunningApplication: 0x6000001044a0 (com.apple.qtkitserver - 12444)>",
//        "<NSRunningApplication: 0x600000104530 (com.apple.WebKit.WebContent - 12786)>",
//        "<NSRunningApplication: 0x6000001045c0 (com.apple.qtkitserver - 12793)>",
//        "<NSRunningApplication: 0x600000104650 (com.apple.coreservices.uiagent - 13042)>",
//        "<NSRunningApplication: 0x6000001046e0 (com.apple.internetaccounts - 13066)>",
//        "<NSRunningApplication: 0x600000104770 (com.oomori.workshop.NSWorkspace - 13141)>"
//        )


    }