What can cause addAttachment to never call its completion block?
func addImage(_ image: UIImage, toFeature agsArcGISFeature: AGSArcGISFeature, completion: @escaping ((Error?) -> Void)) {
agsArcGISFeature.load() { error in
if let error = error {
completion(error)
return
}
guard let imageData = image.jpegData(compressionQuality: 0.85) else {
completion(nil)
return
}
print("Calling addAttachment()")
agsArcGISFeature.addAttachment(withName: "image.jpg", contentType: "jpg", data: imageData) { agsAttachment, error in
if let error = error {
print("addAttachment() completed with error")
completion(error)
} else {
print("addAttachment() completed successfully")
completion(nil)
}
}
}
}
In the above code, neither of the print() statements (lines 16 or 19) ever execute. The feature is a loaded feature from a feature service in ArcGIS Online. I feel like I am missing something simple.