小编Ary*_*yap的帖子

Swift 3.0呼叫结果未使用

我在swift 3.0中写作

我有这个代码,它给我警告结果,呼叫未使用

        public override init(){
            super.init()
        }

        public init(annotations: [MKAnnotation]){
            super.init()
            addAnnotations(annotations:  annotations)

        }

        public func setAnnotations(annotations:[MKAnnotation]){
            tree = nil
            addAnnotations(annotations: annotations)
        }

        public func addAnnotations(annotations:[MKAnnotation]){
            if tree == nil {
                tree = AKQuadTree()
            }

            lock.lock()
            for annotation in annotations {
    // The warning occurs at this line
         tree!.insertAnnotation(annotation: annotation)
            }
            lock.unlock()
        }
Run Code Online (Sandbox Code Playgroud)

我已经尝试在另一个类中使用此方法,但它仍然给我错误,insertAnnotation的代码在上面

func insertAnnotation(annotation:MKAnnotation) -> Bool {
        return insertAnnotation(annotation: annotation, toNode:rootNode!)
    }

    func insertAnnotation(annotation:MKAnnotation, toNode node:AKQuadTreeNode) -> Bool {

        if !AKQuadTreeNode.AKBoundingBoxContainsCoordinate(box: node.boundingBox!, coordinate: annotation.coordinate) {
            return false …
Run Code Online (Sandbox Code Playgroud)

ios swift swift3

143
推荐指数
1
解决办法
6万
查看次数

在快速3中的NSValue(CMTime:)?

我有这个代码

  var times = [NSValue]()
        for time in timePoints {
            times.append(NSValue(CMTime : time))
        }
Run Code Online (Sandbox Code Playgroud)

我得到一个错误,他们在swift 3中没有什么叫做CMTime我真的找不到cm时间的任何参数.

cocoa-touch ios swift swift2 swift3

4
推荐指数
1
解决办法
1652
查看次数

标签 统计

ios ×2

swift ×2

swift3 ×2

cocoa-touch ×1

swift2 ×1