XCode问题 - 无法从contents.xcplayground加载设置


3

我最近将几个操场文件从我的文档文件夹移动到了iCloud Drive。然后我注意到他们所有的文件都被复制了,而且可以打开。 我将它们移回原始位置到文档文件夹,但仍然无法打开。

关于如何恢复我写的代码的任何建议?

enter image description here

更新: 我有一个Dropbox中的一个文件的副本。事实证明,操场文件包含一些文件,一些文件丢失或没有上传到iCloud。 (iCloud bug?羞耻!)

然后,我看了一下内容(右键单击>显示包内容),找到了一个包含我代码的swift文件。

enter image description here

Answers:


3

当您压缩和解压缩文件并且Mac将某些文件转换为.xml文件时,会发生这种情况,具体取决于您的mac设置。解决方案是: 右键单击“xxx.playground”文件 - >显示包内容,您将看到“contents.xcplayground”文件。右键单击此文件并转到“获取信息”。现在在文件名和扩展名部分中,最后删除.xml。

对“playground.xcworkspace”工作空间文件夹下的“contents.xcworkspacedata”执行相同操作。 enter image description here


0

将iOS开发项目文件夹从内部硬盘驱动器上的一个位置移动到另一个位置后,我遇到了同样的问题。我使用命令行终端窗口导航到我的PlayGround文件夹并钻取镇:

游乐场/ 20160519.playground / playground.xcworkspace / xcuserdata / userName.xcuserdatad

查找 UserInterfaceState.xcuserstate 在这条路径的底部,我编辑了它并根据我完成的文件夹重组更新了许多文件路径。然后我导航到了 20160519.playground 并用Xcode打开它。这次我没有得到错误;相反,它给了我一个 载入中... 消息但负载从未完成。

我认为我正在努力解决Xcode的位置刚性问题,但根据我的文件夹重组,显然还有一个细节或者更多要查找和更新。


通过一直导航到我的操场项目,我能够从我离开的地方拿起 playground.xcworkspace 文件并用Xcode打开。
— Dave Sieving

0

在我的情况下,我有一些旧的操场文件,当尝试在较新版本的Xcode中打开它们时出现以下错误:

Playground文件缺少“Contents.swift”文件。

我的解决方案是右键单击playground文件并选择 显示包装内容 。在我的包文件中,我找到了一个名为的文件 科1.swift 。

enter image description here

我将此文件重命名为 Contents.swift 。之后,我能够成功打开操场文件。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.