XCode - 为什么我找不到文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10422023/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:10:15  来源:igfitidea点击:

XCode - why do I get a file not found?

xcodeurbanairship.com

提问by John

I've added the Airship (from UrbanAirship) directory into my xcode project for my iPhone/iPad app. In my "build settings>search paths>header search paths" and "build settings>search paths>library search paths", I'm pointing to those directories recursively. I've also included the libuairship-1.2.1.a file3 into the required frameowrks/libraries.

我已将 Airship(来自 UrbanAirship)目录添加到我的 iPhone/iPad 应用程序的 xcode 项目中。在我的“构建设置>搜索路径>标题搜索路径”和“构建设置>搜索路径>库搜索路径”中,我递归地指向这些目录。我还将 libuairship-1.2.1.a file3 包含到所需的框架/库中。

When I go into my appdelegate.m and appdelegate.h, as soon as I type #import "UA", it autocompletes for me #import "UAirship.h". So i assume this is great ,because i guess it means it knows the file exists!

当我进入我的 appdelegate.m 和 appdelegate.h 时,只要我输入#import "UA",它就会为我自动完成#import "UAirship.h"。所以我认为这很棒,因为我猜这意味着它知道文件存在!

but when I do a build, it Xcode complains that the file UAirship.h can not be foudn. I tried typing #import "directoryname/UAirship.h", but it still can't find it.

但是当我进行构建时,Xcode 抱怨无法找到文件 UAirship.h。我尝试输入 #import "directoryname/UAirship.h",但仍然找不到。

How do i fix this problem?

我该如何解决这个问题?

Screenshot depicting error message

描述错误消息的屏幕截图

采纳答案by Mark Willsher

This likely means that the file is part of your project, but its path is incorrect (for whatever reason). This will be visible in that if you locate the file in the project browser its name will be red.

这可能意味着该文件是您项目的一部分,但其路径不正确(无论出于何种原因)。这将是可见的,因为如果您在项目浏览器中找到该文件,其名称将为红色。

Assuming that is the case you can select it and edit the files location properties, or delete it from the project and then add that file back again.

假设是这种情况,您可以选择它并编辑文件位置属性,或将其从项目中删除,然后再次添加该文件。

This can happen easily if you import or open projects from other systems.

如果您从其他系统导入或打开项目,这很容易发生。

Regards

问候

回答by user1006117

I am sure it is the path under - header search paths.

我确定它是 - 标题搜索路径下的路径。

I just had it set to ../Airship/** and had the same problem you did.

我刚刚将它设置为 ../Airship/** 并且遇到了与您相同的问题。

Now that I changed it to ./Airship/** and it works fine.

现在我将其更改为 ./Airship/** 并且它工作正常。

I also had to import

我也不得不导入

#import "UAirship.h"
#import "UAPush.h"
#import "UAInbox.h"
#import "UAInboxUI.h"

in the application delegate.

在应用程序委托中。

Hope this helps.

希望这可以帮助。

回答by Mads Mob?k

For XCode 5.1 I had to set this to ./Airship(recursive)

对于 XCode 5.1,我必须将其设置为./Airship(递归)

回答by ioopl

This did the trick for me,

这对我有用,

Delete Pod folder and Podfile.lock

删除 Pod 文件夹和 Podfile.lock

then "pod install"

然后“吊舱安装”

then "pod update”

然后“豆荚更新”

Or sometimes, pod update and then pod install

或者有时, pod update 然后 pod install