2016-10-02 62 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

相關問題