Is there any way (programmatically) that i can find the location of "Resource" folder. I want to create a new file in it at run time.
To get path to resource folder use:
NSString *path = [[NSBundle mainBundle] resourcePath];
However you won't be able to write anything there in run-time. New files should be saved to 1 of the following directories (depending of their usage):
Documents directory - persists between app launches and backuped by iTunes
NSString* docPath = [NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
Caches directory - persists between app launches but not backuped by iTunes - you should place there files that can be easily restored by your program to improve device backup time
NSString* cachesPath = [NSSearchPathForDirectoriesInDomains
(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
Temporary directory - may not persist between app launches
NSString* tempPath = NSTemporaryDirectory();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With