macOS/iOS API解説

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

目次

enabledRemoteNotificationTypes

INDEX>AppKit>NSApplication

有効なリモート通知タイプを取得します

解説

有効なリモート通知タイプを取得します
Objective-C

@property(readonly) NSRemoteNotificationType enabledRemoteNotificationTypes

Swift

var enabledRemoteNotificationTypes: NSRemoteNotificationType { get }

返り値

Objective-C

NSRemoteNotificationType

Swift

NSRemoteNotificationType

引数

なし

フレームワーク

ApplicationKit

クラス

NSApplication

使用可能

10.7

編集時のバージョン

OS X 10.10

例文

Objective-C

Swift

    //NSApplication enabledRemoteNotificationTypes
    //リモート通知の管理
    @IBAction func function019(sender: AnyObject) {
        //共有アプリケーションインスタンスを取得
        let anApplication = MyApplication.sharedApplication()
        //リモート通知の取得
        var types:NSRemoteNotificationType = anApplication.enabledRemoteNotificationTypes
        
       //ifで判定
        if (types == NSRemoteNotificationType.None)
        {
            NSLog("None")
        }
        
        //switchで分岐
        switch types {
        case NSRemoteNotificationType.None :
            NSLog("None")
        case NSRemoteNotificationType.Badge :
            NSLog("Badge")
        case NSRemoteNotificationType.Sound :
            NSLog("Sound")
        case NSRemoteNotificationType.Alert :
            NSLog("Alert")
        default :
            break
        }
        
        
    }