#StackBounty: #ios #swift #ios14 #phasset phResourceManager.writeData(for… wont run on iOS 14

Bounty: 50

Before I updated to iOS 14 on my iPhone, this code was working perfectly. After, iOS 14 this is weirdly not running… it is very odd and I have not seen any solution online, additionally from my investigation, I have not been able to see any change.

This code is used in order to retrieve a videoURL for this video from the imported Camera Roll (I use import Photos…).

phResourceManager.writeData(for: resource.last!, toFile: newURL!, options: resourceRequestOptions) { (error) in
    if error != nil {
        print(error, "not c67omplted error?")
    } else {
        print("woah completedd 345?")
        
        newUserTakenVideo.videoURL = newURL
        print(newUserTakenVideo.videoURL, "<--?")
    }
}

EDIT:
To be clear, it "does not run" means the compleition block never runs… as in it never even runs and gives an error, the compleition block simply never is called (nothing prints at least..)

And here is a print statement printing out all the values I pass in to the parameters:

phResourceManager:
<PHAssetResourceManager: 0x282d352c0>

resource.last:

Optional(<PHAssetResource: 0x28128bc00> {
    type: video
    uti: public.mpeg-4
    filename: v07044090000bu6n1nhlp4leque7r720.mp4
    asset: C97B45D3-7039-4626-BA3E-BCA67912A2A9/L0/001
    locallyAvailable: YES
    fileURL: file:///var/mobile/Media/DCIM/113APPLE/IMG_3404.MP4
    width: 576
    height: 1024
    fileSize: 4664955
    analysisType: unavailable
    cplResourceType: Original
    isCurrent: YES
}) 

newURL:
Optional(file:///var/mobile/Containers/Data/Application/E2792F47-142E-4601-8D5B-F549D03C9AFE/Documents/Untitled%2027228354.MP4)

resourceRequestOptions:
<PHAssetResourceRequestOptions: 0x28230d480>

Note: this is the decleration for the resource variable:

let resource = PHAssetResource.assetResources(for: (cell?.assetPH)!)


Get this bounty!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.