ios - Trouble adding observer to NotificationCenter in Swift 3.0 -


i'm having trouble adding notification observer in swift 3.0.

code so:

notificationcenter.default.addobserver(self, selector: .playeritemdidplaytoendtime, name: notification.name(avplayeritemdidplaytoendtimenotification), object: playeritem) 

i getting error: "cannot invoke value of type notification.name.type (aka nsnotification.name.type) argument list (nsnotification.name)"

with:

avf_export nsstring *const avplayeritemdidplaytoendtimenotification      ns_available(10_7, 4_0); 

what doing wrong here?

as martin r commented, name argument should be:

nsnotification.name.avplayeritemdidplaytoendtime 

and complete code be:

notificationcenter.default.addobserver(self, selector: .playeritemdidplaytoendtime, name: nsnotification.name.avplayeritemdidplaytoendtime, object: playeritem) 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -