Search code examples
iosiphonecocoacocoa-bindingsnsfilemanager

delete files from database permanently ios


I am Making an Audio recorder(m4a extension files). I am Giving a particular URL for the output of the recorded File(in directory). I am able to play it, save the path of the file in database and can retrieve it later. EVery thing is going Fine. BUT I am not able to delete the saved/unsaved files. Every time I record an audio , the file is taking a permanent space. Am not able to delete them.

I tried it over internet(stackoverflow ofcourse). I got Links like this: I have video URL and want to delete it from the iPhone using this URl

But they are showing COCOA ERROR 4 when ever i try to delete them using codes like this: [[NSFileManager defaultManager] removeItemAtPath:strPath error:&error];

Please suggest, and reply


Solution

  • This is the path earlier i was getting , at which i was unable to write file

    /var/mobile/Applications/8584F54E-75D2-4833-8826-29C125E53DBC/Library/Documentation/291013193758w.png

    This morning, I just run my code once again ,. now its showing path

    /var/mobile/Applications/DDA14123-6A88-4756-B2E4-C4A3AA39AA5B/Documents/291013081335test.png

    on this path am able to write my file

    the Difference between two paths is that, first one is of Library/Documentation , where as second one is of Documents

    dont know the difference, but it is working now