9

我从这里下载了这个 Xcode 项目(1.0 版contents.xcworkspacedata

当我尝试打开它时,出现此错误:

Failed to load project at '.../Lesson31_OSXCocoa/Lesson31_OSXCocoa.pbproj', incompatible project version.

如何使用 xcode 4.2 打开项目版本 1.0?

4

2 回答 2

7

You're better off trying to find a newer tutorial, or just studying the code as-is, without expecting to build and run it.

Judging by the modification dates, this code is almost ten years old. Even if you can get a modern version of XCode to open it, there's no reason to think that the headers, libraries, etc., that it needs to compile and run will still be compatible. Moreover, ten years is a long time in software terms. While some of the content might still be applicable, it certainly won't be anywhere near the cutting edge (which itself won't be new by the time you've mastered it).


All that said, if you're really intent on working with that project file in XCode 4.2, the best way is probably to convert it the same way a continuously developed project would have: XCode by XCode.

  • You can download older versions of XCode from Apple here (requires free Apple developer account).
  • Some older version will be able to import that file and update it to a newer format.
  • Assuming you don't stop at that point and use that version of XCode, you can repeat the process with the updated project file and ever-newer versions of XCode until you've arrived at version 4.2.
于 2012-08-02T01:08:35.900 回答
6

创建一个新项目并向其中添加适当的文件相对容易。花了不到 10 分钟(不得不在几个地方更新代码)。请注意,我并没有花太多时间清理这段旧代码 - 不少已弃用的警告。但它运行和工作。我安装了 Xcode 4.3.2,但希望你能用 4.2 打开它。这是它的链接:Lesson31.zip

请注意,执行此操作的过程(因此您可以为任何其他人执行此操作)是创建一个新的 Mac OS X Cocoa Application 项目,将旧项目中的文件(main.m 除外)添加到新项目中,然后添加必要的库来修复链接错误(OpenGL 框架)。如果有 nib,那么您可以在 Xcode 中打开它,然后将带有视图和控制器的窗口从该项目中复制出来,然后将它们粘贴到使用新项目创建的 .xib 文件中。然后根据需要修复编译器警告/错误(添加一些 (char*) 强制,删除对似乎不可用的 std::ios::nocreate 的引用等)。

于 2012-08-06T17:40:13.810 回答