I have a problem with application update. In the version 1.0 I had large number of files downloaded and path to those files are persisted in coredata as a attribute on object.
for example: /var/mobile/Applications/43543f-435435-etc.../Library/folder/image.png
After I try to test update with testflight or installing version 1.1 with iTunes, the path
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *applicationDirectory = [paths objectAtIndex:0];
now returns different, something like
/var/mobile/Application/324dfd-325dfd..etc/
And my application fails to show all the images and data, since I pull down the path saved on the coredata object. But what surprises me the most is, when I install the version 1.1 directly from xcode, it works good, and nothing is changed. What should I do? Should I crate a upgrade script to change the Library path for the each file in coredata or is there a better way ?
Thank you
I am assuming that you are storing the full path to the file within the Core Data object. You should be storing a relative path from the Library
folder, which you retrieved using NSSearchPathForDirectoriesInDomains()
.
This will mean you have to create the full path at runtime using the Library folder plus the relative element retrieved from Core Data.
This will then survive an app upgrade.