0

我在 Swift 中使用了 iBeacon 库,

// Listening Notifications
func registerNotifications() {
    NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector.convertFromStringLiteral("handleNotification:"), name: kBUOYDidFindBeaconNotification, object: nil)
}

使用iOS8.1 SDK后,小编说:

'Selector.Type' does not have a member named 'convertFromStringLiteral'

我怎么解决这个问题?我尝试了以下代码但无法正常工作。

 Selector("handleNotification:")
4

1 回答 1

0

只写没有选择器的字符串:

NSNotificationCenter.defaultCenter().addObserver(self, selector: "handleNotification:", name: kBUOYDidFindBeaconNotification, object: nil)
于 2014-11-06T07:09:23.343 回答