I am developing an application in iPhone .This application need to store 3 music file (.mp3) to iOS device (the files are from a webserver). The downloading function working perfectly (Using ASIHTTPrRequest). Some time the music saving not working perfectly, that means I am using a checking before the music file go to music player.
playpath=@"/Users/company/Library/Application Support/iPhone Simulator/5.0/Applications/3D5AD723-F18E-4F44-B3CB-FAEF2EA4963B/Documents/329/25-06-2012/330217/work25-06-2012330217.mp3"
NSFileManager*fileM=[NSFileManager defaultManager];
if([fileM isReadableFileAtPath:playpath])
{
}
The playpath (directory path) change with each downloading. some time the downloading paths playing the music and some time this not playing ie this path can not satisfied the above condition .
My questions are
- What is reason for the above problem?
- What is the exact functionality of isReadableFileAtPath?
Instead of explicitly writing out the file path, have the device find the path for you. Here’s what I do:
Add this to whatever class needs to save or load data. Then you’ll be able to get the location of your file with: