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
Post a Comment