第13月第10天 swift3.0

1.

Type 'Any' has no subscript members

  这一条简直莫名其妙。大体意思就是,你这个类型"Any"不是个数组或者字典,不能按照下标取东西。

  我之前通过一个方法默认创建了一个字典,编译器也认为这是个字典,所以允许我取东西,但是现在编译器翻脸了,说你必须告诉我这是个字典我才能让你取东西。okok。

1     (dic as! NSDictionary)

  同理还有各种类型不匹配的问题,强制转换就可以了。(偷偷说,真怀念OC的弱类型的时代~)

http://www.cnblogs.com/SoulKai/p/6056659.html

2.

        DispatchQueue.global(qos: .background).async {
            // Background Thread
            let rs = db.executeQuery(sql, withArgumentsIn: [])
            
            var arrayM = [NoteItemModel]()
            
            DispatchQueue.main.async {
                // Run UI Updates
                callBack(arrayM)
            }
        }

3.

Module compiled with swift 3.1 cannot be imported in Swift 3.0.2

update --no-use-binaries

https://stackoverflow.com/questions/43238856/module-compiled-with-swift-3-1-cannot-be-imported-in-swift-3-0-2

原文地址:https://www.cnblogs.com/javastart/p/7644844.html