how to access mp3 files other than resource folder's mp3 files
Please tell me is there any way to access MP3 files other than resource folder's MP3 files.
I am thankful to stackoverflow for this code:
- (BOOL)uploadImage:(NSData *)imageData filename:(NSString *)filename{
NSString *filePath = [[NSBundle mainBundle] pathFo开发者_如何学GorResource:@"rockstar" ofType:@"mp3"];
NSData *myData = [NSData dataWithContentsOfFile:filePath];
}
I want to access MP3 files from an iPhone library or other folder.
Although it is not possible to directly access files in another folder outside your application, you can search the user's music library and play music from it using the MediaPlayer framework.
There is a complete guide at: http://developer.apple.com/library/ios/#documentation/Audio/Conceptual/iPodLibraryAccess_Guide/Introduction/Introduction.html
The access outside of your application folder is very limited for protection of the general filesystem of the iPhone, which is Apple trying to protect etc.
So in short: No :-)
精彩评论