I have viewcontroller from where i upload media to firebase & send url of media to my server as API call.Now for uploading images & call API i have created seprate class.There i have created a function which does the uploading work.
OfflineSync Class Function
func UploadMediaToFireBase(sucess:@escaping ()->(),failure:@escaping (DIError)->()) {
DIFirebaseImageManager.firebaseInstance.uploadImage(data: data, withName: filepath, mimeType: mimeType, progress: { (progress)
in
}) { (callback, firebaseUrl, error) in
if let url = firebaseUrl {
self.uploadplace(place: self.place, done: {
sucess()
Utility.shared.hideLoader()
}, failed: { (result) in
failure(result)
Utility.shared.hideLoader()
})
}
}
}
Now when i recive url i call this function in
func uploadplace(place:place,done:@escaping ()->(),failed:@escaping (DIError)->()) {
if let placeId = place.id {
placeManager.shared.editplace(placeId: placeId, place: place, success: { (success) in
AlertBar.show(.success, message: AppMessages.place.placeEdited)
done()
}, failure: { (failure) in
self.status = .cancelled
failed(failure)
})
}
}
Once i uploading of media on firebase & url saved on my server then i send callback to my controller as below code
OfflineSync.shared.UploadMediaToFireBase(sucess: {
DILog.print(items: "CallBack to MediaController")
self.navigationController?.popViewController(animated: true)
}, failure: { (failure) in
})
}
But issue is i never get any callback to my controller.I get callback of uplaodplace to uplaodmediatofirebase function.But i never get callback to my controllrer.Please tell what can be the issue?