Closed shahchirag2110 closed 7 years ago
Try removing the WithCompletion
from method name. Or simply start fresh, see if you get the method in the intelli-sense when you do a mapView.
.
I am including a snippet thats working for me.
self.mapView.exportImage { [weak self] (image:UIImage?, error:NSError?) -> Void in
if let error = error {
UIAlertView(title: "Error", message: error.localizedDescription, delegate: nil, cancelButtonTitle: "Ok").show()
}
if let image = image {
//on completion imitate flash
self?.imitateFlash(image)
}
}
@singhgag Thank for reply but same error look the screenshot and if start fresh method not found i am not getting the method in intelli-sense of xcode
self.mapView.exportImage { [weak self] (image:UIImage?, error:NSError?) -> Void in
if error != nil{
UIAlertView(title: "Error", message: error.localizedDescription, delegate: nil, cancelButtonTitle: "Ok").show()
}
if let image = image {
//on completion imitate flash
// self?.imitateFlash(image)
}
}
In intelli-sense below method i got And error something like below
@singhgag did import any thing in file i import only ArcGIS and i am coding in Xcode 8 and swift 3.0
@shahchirag2110 Apologies if you have already tried this. So the problem is that intellisense (auto-complete) is not picking up the ArcGIS API. I experienced this a few times and solved it by closing all open projects and Quiting Xcode. On reopening the project auto-complete operated correctly.
@maryharvey I tried it 2 to 3 times but it is not working any how
@shahchirag2110 This sounds like a general problem with your auto-complete (not specific to the Samples)... if you agree you could transfer this query to the geonet channel? https://geonet.esri.com/community/developers/native-app-developers/arcgis-runtime-sdk-for-ios ? Please state the version of Xcode and Swift.
Just a note on the original code. NSError
has been replaced with Error
class in Swift 3.x, that is why compiler is complaining.
I found it's best not to include type in blocks to avoid this issues in the future:
self.mapView.exportImageWithCompletion { [weak self] (image, error) -> Void in
if let error = error {
UIAlertView(title: "Error", message: error.localizedDescription, delegate: nil, cancelButtonTitle: "Ok").show()
}
if let image = image {
//on completion imitate flash
}
}
I wrote code like this . I need this thing working urgently . Please help me
But in swift 3.0 this method not found see the screen shot