ios - why is PHPhotoLibrary performChanges creationRequestForAssetFromVideoAtFileURL so slow? -
i'm measuring times tens of seconds minutes depending on size of video. shouldn't change request fast (local flash disk copy/meta data/checksums) adds local video photolibrary/camera roll? this issue appears occur when icloud backups turned on. haven't been able find helpful information through web search or apple dev docs.
sample code:
func exportassettophotolibrary(videourl: nsurl, _ exportedasset: (localidentifier: string) -> void) { var localidentifier = "" var starttime = nsdate.timeintervalsincereferencedate() phphotolibrary.sharedphotolibrary().performchanges({ let assetrequest = phassetchangerequest.creationrequestforassetfromvideoatfileurl(videourl) let assetplaceholder = assetrequest.placeholderforcreatedasset localidentifier = assetplaceholder.localidentifier }, completionhandler: { success, error in var elapsedtime: nstimeinterval = nsdate.timeintervalsincereferencedate() - starttime nslog("exported cameo video photo library \(elapsedtime)") exportedasset(localidentifier: localidentifier) }) }
Comments
Post a Comment