xonegirlz
xonegirlz

Reputation: 8967

path and directories in iOS

So I have the following method to get a path:

- (NSString *)filePath {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_json", self.identifier]];
    return filePath;
}

this path will be used for a keychain access kSecAttrAccount and kSecAttrGeneric. So therefore I am expecting it to have the same path. However it turns out that after I upgrade my app this path changes.

Before it was:

/var/mobile/Applications/CEE344F7-4FE1-4455-BD6D-A4D6EAA4F5FE/Documents

and after wards it was:

/var/mobile/Applications/A6429F46-972C-4BC1-A71B-2786312663E8/Documents/

What can cause this to happen?

Upvotes: 0

Views: 100

Answers (1)

DrummerB
DrummerB

Reputation: 40211

That means that iOS installs the updated version of the app in a new folder. Once that is done it will move the user data over to the new folder and remove the old one. This is probably done, so an error during installation won't corrupt the existing app.

Upvotes: 2

Related Questions