ローカルバンドルパスにデータを保存するアプリの新しい更新をリリースする準備をしています。このパスに保存されているデータが更新時に削除されないようにしたいと思います。これは起こり得ますか、そして私は何に注意すべきですか?
これは、データを格納するためのパスを取得するために使用しているコードです。
// Temporary method variables
NSError *error;
// Create a list of paths
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
// Get the path to the apps documents directory from the array
NSString *documentsDirectory = [paths objectAtIndex:0];
// Create a full path to the file
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"FFUserPrefs.plist"];
// Access the file manager
NSFileManager *fileManager = [NSFileManager defaultManager];
// Check if the file exists and if not, copy from the bundle path to the documents path
if (![fileManager fileExistsAtPath:path])
{
// Get path to file from bundle directory
NSString *pathBundle = [[NSBundle mainBundle] pathForResource:@"FFUserPrefs" ofType:@"plist"];
// Copy pref file to app documents folder
[fileManager copyItemAtPath:pathBundle toPath:path error:&error];
}
ユーザーがこのディレクトリに保存したデータが失われる可能性があるので、更新後もデータが残っていることを確認したいと思います。私が尋ねる唯一の理由は、リリースアプリケーションがインストールされている電話でxCodeを介して新しいビルドを実行した後、データが消去されて新しく開始されたためです。私は何が欠けていますか?アプリバンドルパスはXcodeとリリースの間で変更されますか?どんな情報でも大歓迎です!