How to process large files using NSData?

I have a very large video and I need to record this video in order to upload it to Dropbox .

I tried to use NSData, but since this file is too large, my application always crashes, so I don’t know what I can do now.

For small videos, I used this:

NSData(contentsOfURL: self.newAsset.URL)!.subdataWithRange(NSMakeRange(0, 10000000))

and I had no problems with this, but when the video is too large, I have an error:

Unable to allocate memory

So what can I do to organize the data of large videos?

+4
source share
2 answers

NSURLSession, , RESTKit AFNetworking. NSURLSession NSURLSession : , . . source ( )

  • NSData. , . .
  • , .
  • , .

raywenderlich.com Image Source:

+2

URL- NSURLSession

- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromFile:(NSURL *)fileURL;
0

Source: https://habr.com/ru/post/1649902/


All Articles