Вопрос

I have an audio file (binary) file which is stored in a file in document folder, I want to read the data from file and upload to server using a php script, my question is whats the best way to read this file form the disk ?

Это было полезно?

Решение

You can simply use

NSData *fileData = [[NSData alloc] initWithContentsOfFile:@"My File Path"];

to read the contents of the file. But if the file is .5 to 2 mb, sent the read operation to a thread using GCD, NSOperationQueue or Similar.

If you are targeting iOS7 and above you could try the new NSURLSession

https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSession_class/Introduction/Introduction.html

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top