XCode - why do I get a file not found?

北战南征 提交于 2019-12-23 13:08:08

问题


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.

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!

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.

How do i fix this problem?


回答1:


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




回答2:


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.

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

I also had to import

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

in the application delegate.

Hope this helps.




回答3:


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




回答4:


This did the trick for me,

Delete Pod folder and Podfile.lock

then "pod install"

then "pod update”

Or sometimes, pod update and then pod install



来源:https://stackoverflow.com/questions/10422023/xcode-why-do-i-get-a-file-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!