编译Prefix.pch文件时出错,导致更大的问题

发布于 2024-09-27 21:14:42 字数 1043 浏览 4 评论 0原文

更新 2

我发现,如果我将“Base SDK”更改为“iOS Simulator 3.2”(iPad ???),则在进行“构建和更新”时不会出现此错误。分析一下...但这应该是一个iPhone应用程序。我正在运行 XCode 3.2.4...创建项目时是否缺少某些内容?我选择 iPhone 作为目标设备,不确定发生了什么。

原始

我在发现 iPhone 应用程序内存泄漏时遇到问题。我尝试运行“构建和分析”,但当它到达 MyApp_Prefix.pch 文件时,它显示“分析器由于解析错误而跳过了此文件” - 然后 50% 的文件显示“由于解析而跳过了此文件”错误 - /var/folders/ ... /MyApp_Prefix.pch 文件未找到”。

App实际编译运行,Prefix.pch文件确实存在。

当我打开第一个错误下出现的所有错误时,它开始打开框架中的文件,我不知道为什么其中会出现问题。

alt text

以下是 .pch 文件的内容:

//
// Prefix header for all source files of the 'Tickets' target in the 'Tickets' project
//

#ifdef __OBJC__
    #import <Foundation/Foundation.h>
    #import <UIKit/UIKit.h>
#endif

更新 以下是当我单击“函数声明符后的预期函数体”、“预期类型”等时打开的文件... CGPDFContext.h UIView.h UIApplication.h UITextView.h UIWebView.h

这些都位于框架中。

我尝试创建一个全新的项目并导入现有的类,但它给了我同样的错误。

我尝试运行 Build &分析我的一个旧项目,它使用相同的框架,并且运行良好。

Update 2

I discovered that if I change the "Base SDK" to "iOS Simulator 3.2" (iPad ???) it does not give me this error when doing Build & Analyze... But this is supposed to be an iPhone App. I am running XCode 3.2.4... am I missing something when I create the Project? I am choosing iPhone as the target device, not sure what's going on.

Original

I am having problems finding a memory leak in my iPhone App. I tried running "Build & Analyze", but when it gets to the MyApp_Prefix.pch file, it says "Analyzer skipped this file due to parse errors" - then 50% of the files after that say "Skipped this file due to parse errors - /var/folders/ ... /MyApp_Prefix.pch file not found".

The App actually compiles and runs, and the Prefix.pch file does exist.

When I open all the errors that appear under the first error, it starts opening files that are in the frameworks, which I don't know why there would be something wrong in there.

alt text

Here is the contents of the .pch file:

//
// Prefix header for all source files of the 'Tickets' target in the 'Tickets' project
//

#ifdef __OBJC__
    #import <Foundation/Foundation.h>
    #import <UIKit/UIKit.h>
#endif

UPDATE
Here are the files that open when I click the 'expected function body after function declarator', 'expected type', etc...
CGPDFContext.h
UIView.h
UIApplication.h
UITextView.h
UIWebView.h

These are all located in the Frameworks.

I tried creating an entirely new project and importing my existing classes, and it gave me the same errors.

I tried running Build & Analyze on one of my older projects, which use the same Frameworks, and it runs fine.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

听风吹 2024-10-04 21:14:42

我刚刚遇到了完全相同的问题。我从模拟器切换到设备并再次运行“构建和分析”,你瞧,它起作用了。不要问我为什么,但这至少使您能够使用分析功能。

I just had the exact same problem. I switched from simulator to device and ran "Build & Analyze" again, and lo and behold, it worked. Don't ask me why, but at least this enables you to use the analyze feature.

空城缀染半城烟沙 2024-10-04 21:14:42

我用以下内容修复了我的构建 - 当前版本的 XCode 中似乎存在错误,因此该标志未正确设置:

#ifdef __OBJC__
  #ifndef __IPHONE_OS_VERSION_MIN_REQUIRED
    #define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_3_0
  #endif

  #import <Foundation/Foundation.h>
  #import <UIKit/UIKit.h>
#endif

I fixed my build with the following - there seems to be a bug in the current version of XCode so the flag isn't set properly:

#ifdef __OBJC__
  #ifndef __IPHONE_OS_VERSION_MIN_REQUIRED
    #define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_3_0
  #endif

  #import <Foundation/Foundation.h>
  #import <UIKit/UIKit.h>
#endif
掀纱窥君容 2024-10-04 21:14:42

您可以查看 .pch 文件,它实际上是一个包含/导入的文本文件。也许里面有一些垃圾。

You can take a peek in the .pch file, its actually a text file with includes/imports. Maybe there is some garbage in there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文