I am relatively new to coding and keep consistently getting an 'EXC_BAD_ACCESS' error. This error highlights the following line of code in the 'FIRStorageUploadTask' file. EXC_BAD_ACCESS Error
One thing that that makes this more confusing for me is that everything works as expected, the image(s) upload fine to Firebase Storage. The following is my code where the Firebase actions are happening:
func saveImagesToFirebaseAndRealm() {
let currentWalkImageRef = Constants.walkImagesRef.child("\(currentWalkID!)")
for (index, urls) in imageArray.enumerated() {
let imageRef = currentWalkImageRef.child("image\(index).jpeg")
let uploadTask = imageRef.putFile(from: urls, metadata: nil) { (metadata, error) in
guard let _ = metadata else {
print("An error occured while trying to upload the file")
return
}
}
uploadTask.enqueue()
let newImage = WalkImages()
newImage.imageURL = imageRef.fullPath
newImage.walkID = currentWalkID!
do {
try realm.write {
realm.add(newImage)
}
} catch {
print("error saving image ref to Realm")
}
}
}
Despite everything working correctly, the app freezes, I never get a message in the console RE a successful/unsuccessful write to the database, so clearly nothing is going further than this code.
I do get the following error message in the debug console:
errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}
This has not caused any issues however, my images pick correctly and make it to Firebase, but this issue has been heavily documented here, no answers there seem to have any effect on this error.
I have found some advice online which may be the cause of this problem, but this goes all into the way memory is handled and unfortunately, this goes well past my depth of knowledge (which if anyone could point me in the direction of learning material for this, that would be great).
Hopefully someone can shed some light on this for me as I have been trying to fix this for 2 days and it's driving me nuts.
Thank you in advance, Adam