开发者

Saving audio files in document's folder of iPhone and later delete it when uploaded to the server?

I have a situation where I will be recording audio files and save it into the documents folder of the app until the user uploads it to the server. The audio recorder will record the sound and it will save the file in the documents folder as he comes out of the audi开发者_JS百科o recording screen. Any suggestions?

Thanks


Path to the documents directory:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:fileName];

Saving the data (an NSData) to the documents directory:

BOOL status = [NSDictionary writeToFile:filePath atomically:YES];

Deleting the file after the upload the the server:

BOOL status = [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜