迁移到沙盒环境未进行。

3

我正在对一个现有应用进行沙盒化,但由于某些原因迁移似乎无法正常工作,尽管我完全按照文档中指定的步骤进行操作。总结一下,这是我正在做的事情:

  1. I have removed the existing container (in ~/Library/Containers/com.mycompany.myapp);
  2. I have created the container-migration.plist in the Resources group;
  3. I want to migrate a single file, in ~/Application Support: I have tried to specify the file, and the enclosing folder, neither worked. Here is the migration plist that I am using (I have just changed the application name), with the folder:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>Move</key>
            <array>
                <string>${ApplicationSupport}/myapp</string>
            </array>
        </dict>
    </plist>
    
  4. When I start the application, the new container is created, and a blank file is created but no migration is performed.

我试图迁移的文件是一个CoreData SQLite存储。数据模型没有改变,因此不涉及数据迁移,我只是尝试将CoreData存储移到沙盒容器中。

我想我错过了一些非常明显的东西,因为我找不到任何有用的信息,任何帮助都将不胜感激。


“/myapp” 不应该是您想要迁移的文件/目录的名称吗? - trojanfoe
这是关于编程的内容:“它是,目录为“〜/Library/Application Support/myapp”。上面的plist与此相匹配。” - taglia
1个回答

3

在发布问题后,我注意到系统日志中出现了这个错误:

13/11/2012 4:59:59.026 PM sandboxd[55845]: ([55835]) myapp(55835) deny file-read-data /Volumes/Mac_HD/Users/me/Library/Developer/Xcode/DerivedData/myapp-hfgnivbvxutfvcxjmyntrenofdsh/Build/Products/Debug no receipt verif

在运行应用程序之前,我尝试将其复制到我的桌面上,从那里运行它,然后它可以正常工作。我不明白为什么从构建文件夹中迁移不起作用,但这已足以解决我的问题。

希望这可以避免其他人浪费时间。


哇,非常感谢您。我一直在尝试弄清楚为什么我的迁移清单在过去的三个小时里一直没有任何作用,原来是因为构建文件夹的问题。 - serenn

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接