开发者

Downloading music files to the iphone

开发者 https://www.devze.com 2023-01-10 14:30 出处:网络
I am trying to develop an application which downloads online music data (music files) and makes them available when I am offline.

I am trying to develop an application which downloads online music data (music files) and makes them available when I am offline.

Can anyone he开发者_运维百科lp me? What is the best way to do that?


I like ASIHTTPRequest framework for downloading. You may also use standard NSURLRequest, but as for me it's not as easy-to-use as ASIHTTPRequest.

Update: To save file, you may use Documents directory:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *documentsDirectory = [paths objectAtIndex:0];

To save loaded data into a file, use

- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag

To load:

+ (id)dataWithContentsOfFile:(NSString *)path
0

精彩评论

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