xcode 在 .pch 文件中找不到“AFNetworking.h”文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26374380/
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 05:52:55  来源:igfitidea点击:

"AFNetworking.h" file not found in .pch file

iosobjective-ciphonexcodeafnetworking

提问by Kiran Thapa

I installed AFNetworking using cocoapods. And then I included AFNetworking.h file in Prefix.pch file. Now while building my app it shows "AFNetworking.h" file not found error. I think it's an error related to path.

我使用 cocoapods 安装了 AFNetworking。然后我在 Prefix.pch 文件中包含了 AFNetworking.h 文件。现在,在构建我的应用程序时,它显示“AFNetworking.h”文件未找到错误。我认为这是与路径相关的错误。

Thanks.

谢谢。

回答by Ricardo Anjos

This happened to me when I updated to AFNetworking 2.5.0 from 2.4.1 through Cocoapods.

当我从 2.4.1 通过 Cocoapods 更新到 AFNetworking 2.5.0 时,这发生在我身上。

In XCode go to Product -> Scheme -> Manage Schemes. There delete the project (maintaining the pods) and add the project again. It worked for me.

在 XCode 中,转到 Product -> Scheme -> Manage Schemes。删除项目(维护 Pod)并再次添加项目。它对我有用。

Hope it helps ;)

希望能帮助到你 ;)

回答by Howard Liu

for me replacing

替我换

#import "AFNetworking.h" 

to

#import <AFNetworking/AFNetworking.h>

fix the issue.

解决问题。

回答by Tung Fam

What always worksfor me in most of the cases (including this case as well):

什么总是工作对我来说在大多数情况下(包括这种情况下):

  1. Delete the 'Pods' folderfrom the project directory (just cmd+delete the folder in Finder).
  2. Do pod installvia terminal in the project's directory.
  1. 从项目目录中删除“Pods”文件夹(只需 cmd+删除 Finder 中的文件夹)。
  2. pod install通过项目目录中的终端执行。

回答by Muhammad Usman

After updating pod's to (pod 'AFNetworking', '3.0') I was facing same issue.

将 pod 更新为 (pod 'AFNetworking', '3.0') 后,我遇到了同样的问题。

Replacing

更换

#import "AFNetworking.h"

#import "AFNetworking.h"

With

@import AFNetworking;

@import AFNetworking;

solved this problem!

解决了这个问题!