2016-10-02 35 views
1

更新到Swift 3后很多地方出现这个错误我改变了这个地方?和!但另一个错误出现(类型[字符串:AnyObject]?有没有标名成员)对成员'下标'的模糊引用Swift 3

func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutableRawPointer) { 
     if !didFindMyLocation { 
      let myLocation: CLLocation = change? [NSKeyValueChangeNewKey] as! CLLocation //Ambiguous reference to member 'subscript' 
      viewMap.camera = GMSCameraPosition.camera(withTarget: myLocation.coordinate, zoom: 10.0) 
      viewMap.settings.myLocationButton = true 

      didFindMyLocation = true 
     } 
    } 
+0

的可能的复制[使用 - observeValueForKeyPath:ofObject:变化:上下文:在夫特3](http://stackoverflow.com/questions/39136706/using-observevalueforkeypathofobjectchangecontext -in-swift-3) – vadian

回答

2

,如果您已经添加override你会得到的第一个暗示,不自其超覆盖任何方法的方法。

签名已被更改为

func observeValue(forKeyPath keyPath: String?, 
          of object: Any?, 
           change: [NSKeyValueChangeKey : Any]?, 
          context: UnsafeMutableRawPointer?) 
+0

谢谢你的工作很好@vadian你知道这个问题的答案:http://stackoverflow.com/questions/39673705/xcodeproj-file-within-xcworkspace-created-through-cocoa-pods-是禁用的 – sssaaan

+0

不,我会删除所有豆荚并重新创建它们。 – vadian

+0

谢谢我已经做到了,但所有文件已经在我制作的xcode文件夹中 – sssaaan

相关问题