문제

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