iOS7到iOS8应用程序文件的迁移 [英] iOS7 to iOS8 application files migration

查看:182
本文介绍了iOS7到iOS8应用程序文件的迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在iOS8上测试我的应用程序。一切都运行在纯粹的iOS8上,但我正在努力从iOS7的应用程序文件迁移,将发生在iOS8将被公开发布的用户。由于我的应用程序使用了多个标准目录(文档,应用程序支持,...),所以我想确保迁移过程顺利。

应用程序文件系统结构在iOS8上发生了变化(请阅读 iOS 4 beta版本说明文件系统编程指南)。

当iOS8将安装在设备上时,我想所有先前安装的应用程序和所有相关文件(在文档,应用程序支持等)将被重新组织以匹配新的结构。



你们是否有任何关于在iOS7到iOS8升级期间发生的变化列表的线索?我找不到有关此主题的任何文档。
有没有一种方法来测试/模拟将iOS7应用程序沙箱迁移到新的iOS8沙箱结构?

谢谢

BONUS问题:操作系统升级时应用程序的GUID是否改变?

解决方案


应用程序容器的文件系统布局在磁盘上已更改。

而不是依靠硬编码的目录结构,使用
NSSearchPathForDirectoriesInDomains 函数或
URLForDirectory:inDomain:appropriateForURL:create:error:方法
NSFileManager 使用 URLForDirectory:inDomain:appropriateForURL:create:error:
方法 NSFileManager
$ b

 NSFileManager * yourFileManager = [NSFileManager defaultManager]; 
NSURL * urlForSomeDirectory = [yourFileManager URLForDirectory:NSDocumentDirectory inDomain:NSAllDomainsMask appropriateForURL:nil create:YES error:nil];

如果您正在使用此方法,那么您不需要你可以用 NSDocumentDirectory 。 其他常量 。你可能还想用 NSError ** 来代替最后一个参数。



奖金问题:它不应该,但是你永远不知道。


I am currently testing my app on iOS8. Everything works well on pure iOS8 but I am struggling with the App files migration from iOS7 that will occur for users when iOS8 will be publicly released. As my application uses several "Standard Directories" (Documents, Application Support, ...), I would like to be sure the migration will be smooth.

The application filesystem structure has changed on iOS8 (read iOS beta 4 Release note and the file system programming guide).

When iOS8 will be installed on a device, I guess all previously installed applications and all related files (in Documents, Application Support, ...) will be re-organized to match the new structure.

Do you guys have any clues about the (exhaustive) list of changes that will occur during iOS7 to iOS8 upgrade ? I can't find any documentation on this subject. Is there a way to test/simulate a migration of an iOS7 application sandbox to the new iOS8 sandbox structure ?

Thanks

BONUS question: does the application GUID change when the OS upgrades ?

解决方案

The file system layout of app containers has changed on disk.

Rather than relying on hard-coded directory structure, use the NSSearchPathForDirectoriesInDomains function or the URLForDirectory:inDomain:appropriateForURL:create:error: method of the NSFileManager class.

Using the URLForDirectory:inDomain:appropriateForURL:create:error: method of NSFileManager:

NSFileManager *yourFileManager = [NSFileManager defaultManager];
NSURL *urlForSomeDirectory = [yourFileManager URLForDirectory:NSDocumentDirectory inDomain:NSAllDomainsMask appropriateForURL:nil create:YES error:nil];

If you are currently using this method, then you don't need to change a thing.

You can replace NSDocumentDirectory with many other constants. You may also want to substitute a NSError ** for the last parameter if you would like to catch an error.

The bonus question: It shouldn't, however you never know.

这篇关于iOS7到iOS8应用程序文件的迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆