나만인가, 아니면 NotificationCenter
이 스위프트 3에서 뜨거운 난장판이 되었습니까? :) 나는 다음과 같은 설정이 있습니다알림 센터 크래시 3 스위프트 3
//View Controller A <-- Success!
NotificationCenter.default.addObserver(self, selector: #selector(refreshData), name: .preferenceNotification, object: nil)
func refreshData(){
//...
}
을하지만이 뷰 컨트롤러 : 내 첫 번째보기 컨트롤러에서
//Yonder.swift
extension Notification.Name {
static let preferenceNotification = Notification.Name("preferencesChanged")
}
//I fire the notification elsewhere like this:
NotificationCenter.default.post(name: .preferenceNotification, object: nil)
을,이 위대한 작품을
//View Controller B <-- Crash :(
NotificationCenter.default.addObserver(self, selector: #selector(loadEntries(search:)), name: .preferenceNotification, object: nil)
func loadEntries(search:String?){
//...
}
... 충돌과 :
[NSConcreteNotification 길이] : 인식 할 수없는 셀렉터 예를 들면
내가 알 수있는 한, 내 관찰자가 올바르게 설정되어 있습니다. 내가 뭘 잘못하고 있는거야?
가능한 중복 http://stackoverflow.com/questions/38310080/nsnotifications-in-swift-3) –