2

If I update my iPhone/iPad application with the new version (1.1) will the bundle path change?

For example, my bundle path for 1.0 is /var/mobile/Applications/xxxxx-xxxx-xxxxx-xxxxx/Library/Caches/xxx. If I update my application with a new version (for example, 1.1) will this path change or not?

hopper
  • 13,060
  • 7
  • 49
  • 53
MadhuP
  • 2,019
  • 17
  • 22
  • 4
    @satheeshwaran: no you are not correct. this "xxxxx-xxxx-xxxxx-xxxxx" will change after update. So use relative paths – Midhun MP Jul 24 '13 at 12:39
  • You always have to refer the documents directory by using NSSearchForDirectoriesInDomains method. If you do that even if the part you say is going to change, you will still be referring to the same path. – Satheesh Jul 24 '13 at 12:53

2 Answers2

0

you should not rely on absolute path! Is not a good idea... you should use the NSBundle methods to get the path of a file into the bundle, and to get your application home directory use the relative functions

this to get your home directory

NSHomeDirectory()

and after you can append the relative path like

[NSHomeDirectory() stringByAppendingPathComponent:@"/Library/Caches/xxx"]
Manu
  • 788
  • 5
  • 10
0

you directly access to cache directory by using this code line

[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] copy]

this line of code return you path as string

if you want anything else then please comment

Anurag Soni
  • 1,077
  • 10
  • 14