I have an iCloud database on several iOS and macOS devices, and when I update location
PHAsset
, it does not apply to other devices, even if they seem to be in sync. The location appears in the local device library, but not on other devices. I understand that this metadata must be in sync. No?
the code:
func setCoordinate(newCoordinate: CLLocationCoordinate2D) {
guard let asset = asset else { return }
willChangeValue(forKey: "coordinate")
coordinate = newCoordinate
PHPhotoLibrary.shared().performChanges({
let request = PHAssetChangeRequest(for: asset)
request.location = CLLocation(latitude: self.coordinate.latitude, longitude: self.coordinate.longitude)
}, completionHandler: { (success, error) in
self.didChangeValue(forKey: "coordinate")
})
}
source
share