Swift 2.0 Method cannot be marked @objc because the type of the parameter cannot be represented in Objective-C

后端 未结 3 994
夕颜
夕颜 2020-12-09 15:14

After I have updated Swift 1 to Swift 2.0 I have an issue.

I am getting the following error on the first line of this code:

Method cannot be m

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-09 15:51

    I was getting this because I declared a class Notification of my own and it was messing with Foundation's Notification class.

    @objc func playerItemDidReachEnd(notification: Notification) {...}
    

    So I changed it to Foundation.Notification

    @objc func playerItemDidReachEnd(notification: Foundation.Notification) {...}
    

提交回复
热议问题