Monday, 31 December 2018

ArrayBuffer.getElementSlowPath Does anyone face this error?

In my project I show library image and video to user but in some device I got the crash like ArrayBuffer.getElementSlowPath. Can anyone guide me how i can replicate this issue? I got this issue from Crashlytics.

enter image description here

Here is my code for get videos from phassests.

 func getVideo(withCompletionHandler completion:@escaping CompletionHandler)  {
        let fetchOptions = PHFetchOptions()
        let requestOptions = PHVideoRequestOptions()
        fetchOptions.sortDescriptors = [NSSortDescriptor(key:"creationDate", ascending: false)]
        let fetchResult: PHFetchResult = PHAsset.fetchAssets(with: PHAssetMediaType.video, options: fetchOptions)

        fetchResult.enumerateObjects ({ (assest, index, isCompleted) in
            if assest.sourceType != PHAssetSourceType.typeiTunesSynced{
                PHImageManager.default().requestAVAsset(forVideo: assest , options: requestOptions, resultHandler: { (asset : AVAsset?, video : AVAudioMix?, dic : [AnyHashable : Any]?) in
                    if let _ = asset as? AVURLAsset
                    {
                        let objAssest = GallaryAssets()
                        objAssest.objAssetsType = assetsType.videoType
                        objAssest.createdDate = (assest ).creationDate
                        objAssest.assetsDuration = (assest ).duration
                        objAssest.assetsURL = (asset as! AVURLAsset).url
                        objAssest.localizationStr = assest.localIdentifier
                        objAssest.locationInfo = LocationInfo()
                        if let location = (assest).location
                        {
                            objAssest.locationInfo.Latitude = "\(location.coordinate.latitude)"
                            objAssest.locationInfo.Longitude = "\(location.coordinate.longitude)"
                        }

                        self.media.add(objAssest)
                    }
                    completion(self.media)
                   }                    
                })
            }
        })
    }
}



from ArrayBuffer.getElementSlowPath Does anyone face this error?

No comments:

Post a Comment