I have been searching high and low for anyone that has encountered the same issue,
My problem is when an image is not actually on the device but rather in iCloud, my app fails to retrieve the image. How would i go about remedying this?
My code for PHPicker implementation is as follows, any help would be greatly appreciated.
extension PageViewController: PHPickerViewControllerDelegate {
func presentPicker() {
ArtModel.holdingBay.removeAll()
var configuration = PHPickerConfiguration()
configuration.filter = .images
configuration.selectionLimit = 5
let picker = PHPickerViewController(configuration: configuration)
picker.delegate = self
present(picker, animated: true)
}
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
if results.count 0 {
for result in results {
result.itemProvider.loadObject(ofClass: UIImage.self, completionHandler: { (object, error) in
if let image = object as? UIImage {
DispatchQueue.main.async {
ArtModel.holdingBay.append(image)
}
}
})
}
}
picker.dismiss(animated: true, completion: self.holdingBayCheck)
}
func holdingBayCheck() {
if ArtModel.holdingBay.count 0 {
performSegue(withIdentifier: K.goToCrop, sender: self)
}
}
}