0

刚刚升级到最新的测试版,我收到了这个错误: 在此处输入图像描述

有任何想法吗?

代码是:

func testFileStatusNotifications() {

    let x : XCNotificationExpectationHandler = { (n : NSNotification!) -> Bool in

        // Extract userInfo
        let u = n.userInfo!

        let dict = u.values.first as! [String : Double]
        let percent = dict["percent"]!

        return (percent > 10)
    }

看来处理程序类型必须已更改:

typealias XCNotificationExpectationHandler = (NSNotification) -> ObjCBool

因为它现在是类型ObjCBool

4

1 回答 1

0
func testFileStatusNotifications() {

    let x : XCNotificationExpectationHandler = { (n : NSNotification!) -> ObjCBool in

        // Extract userInfo
        let u = n.userInfo!
        let dict = u.values.first as! [String : Double]
        let percent = dict["percent"]!

        let ret =  (percent > 10)
        return ObjCBool(ret)
    }

这似乎已经解决了问题。

于 2015-08-10T14:28:21.410 回答