Can't generate live photo in iOS 15.1

Work well in iOS 15.0 but after upgrading to iOS 15.1, the codes can't get worked.

_ = PHLivePhoto.request(withResourceFileURLs: [pairedVideoURL, pairedImageURL], placeholderImage: nil, targetSize: CGSize.zero, contentMode: PHImageContentMode.aspectFit, resultHandler: { (livePhoto: PHLivePhoto?, info: [AnyHashable : Any]) -> Void in

    if let isDegraded = info[PHLivePhotoInfoIsDegradedKey] as? Bool, isDegraded {

        return

    }

    DispatchQueue.main.async {

        completion(livePhoto, (pairedImageURL, pairedVideoURL))

    }

})
    func addAssetID(_ assetIdentifier: String, toImage imageURL: URL, saveTo destinationURL: URL) -> URL? {

        

        let kFigAppleMakerNote_AssetIdentifier = "17"

        

        let image = UIImage(contentsOfFile: imageURL.path)

        let imageRef = image?.cgImage

        let imageMetadata = [kCGImagePropertyMakerAppleDictionary: [kFigAppleMakerNote_AssetIdentifier: assetIdentifier]]



        let cfUrl = destinationURL as CFURL



        let dest = CGImageDestinationCreateWithURL(cfUrl, kUTTypeJPEG, 1, nil)

        CGImageDestinationAddImage(dest!, imageRef!, imageMetadata as CFDictionary)

        _ = CGImageDestinationFinalize(dest!)

        

        return destinationURL

    }

@tpian928 did you get this functioning in the end? I see no real difference between your code and mine (although obviously more code is needed to generate a live photo), but it's still not functioning on iOS 15.1.

On attempting to add the paired video and photo to the library we get a non-nil assetPlaceholder but the completion handler is not called by [[PHPhotoLibrary sharedPhotoLibrary] performChanges:completionHandler:] and we see errors like this in the log:

2021-11-09 13:54:48.122501+0000 REDACTED[480:23929] [error] error: XPC: synchronousRemoteObjectProxyWithErrorHandler encountered error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003." UserInfo={NSDebugDescription=The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003.}

2021-11-09 13:54:48.122518+0000 REDACTED[480:23913] CoreData: XPC: XPC connection was invalidated CoreData: error: XPC: synchronousRemoteObjectProxyWithErrorHandler encountered error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003." UserInfo={NSDebugDescription=The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003.}

2021-11-09 13:54:50.796119+0000 REDACTED[480:23913] [tcp] tcp_input [C1.1:3] flags=[R] seq=1735303655, ack=0, win=0 state=LAST_ACK rcv_nxt=1735303655, snd_una=3874278604

I also encountered this problem. iOS15.1 can't generate livephoto. I don't know how to solve it. If you solve it, please tell me the answer. Thank you brother.

This has always been such a bad API. Not surprising they just stopped maintaining it and it broke. Has anyone solved this? I too.. am trying

Can't generate live photo in iOS 15.1
 
 
Q