2016-10-11 7 views
0
NotificationCenter.default.addObserver(self, selector: Selector(("uploaded")), name: NSNotification.Name(rawValue: "uploaded"), object: nil) 

私は名前を書いていました: "uploaded:"とxcodeは上記のコードに修正しました。問題は、私は認識できないセレクタを取得するアプリを実行するときです。Swift 3 NotificationCenterオブザーバのセレクタを使用

いずれか(識別子チェック)#selector構文を使用し、迅速な3

答えて

1
NotificationCenter.default.addObserver(self, selector: #selector(ViewController.update), name: NSNotification.Name(rawValue: "uploaded"), object: nil) 

func update() { 
     // do what you want 
    } 

"ViewController"は、あなたの関数があるクラス名

+0

あるいは、ViewControllerをクラス名に置き換えるのではなく、クラス名をすべて省略して、現在のクラスを使用します。 – Rob

2

で動作するようにこの問題を解決する方法を知っている:パラメータで

#selector(uploaded) 

:パラメータなし

#selector(uploaded(_:)) 
関連する問題