无法为桥接头发出预编译头
我从GitHub上下载了一个项目,然后把下面的文件,其中一些是用OBJ-C写的,我用了一个桥头。
pod 'SnapKit' pod 'MJRefresh' pod 'Alamofire' pod 'Kingfisher' pod 'MBProgressHUD' pod 'pop' pod 'EVReflection' pod 'StreamingKit' pod 'iCarousel' pod 'ReflectionView'
当我用Xcode 9.0 beta 2运行这个项目时,不幸的是错误日志如下所示:
错误:未能发出预编译的头文件'/var/folders/kd/4gh0_kxx3jx4thjb_sssmmcw0000gn/T/EvoRadio-Bridging-Header-97bd5f.pch'为桥接头'/ Users / ringo / Downloads / EvoRadio-master / EvoRadio / Resources / EvoRadio-桥接-Header.h”
我GOOGLE了,但没有这样的问题。错误意味着它需要一个PCH文件? 这是我的.pch
头configuration: 它不能解决它。
如何做到这一点?
在joincocoa豆荚encryption核心数据后,我也得到了完全相同的问题(Xcode9 beta 6)。
这是我的PodFile
:
# Uncomment the next line to define a global platform for your project platform :ios, '9.0' pod 'EncryptedCoreData', :git => 'https://github.com/project-imas/encrypted-core-data.git' target 'Root' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! # Pods for Root target 'RootTests' do inherit! :search_paths # Pods for testing end target 'RootUITests' do inherit! :search_paths # Pods for testing end end
解:
1我添加$(inherited) non-recursive
Search Path -> Header Search Paths
2然后添加${PODS_ROOT} recursive
到Search Path -> User Header Search Paths
上述两个在我的项目目标build立设置。
请看看这些答案:
1inheritance标题searchpath
2inheritance用户searchpath
确保打开正确的项目工作区,否则Podfile
可能没有编译所需的全部资源。
我曾经在一个以前工作正常的项目上看到了同样的错误。
我发现我不小心打开了ProjectName.xcodeproj
文件而不是ProjectName.xcworkspace
文件。 打开xcworkspace
文件,并重新启动,项目再次工作!
你可以试试这个解决scheme。 我用这种方法解决了同样的问题。
- 首先点击标志
- 然后点击“编辑scheme”:
- 现在,在构build选项卡下,选中“查找隐式依赖关系”:
然后做一个干净的,再次build立。
在我的情况下,我有一个类似的编译器错误,像在我的项目文件之一“未知的types”,所以我只是把它添加到有问题的文件,并立即解决它。
#import <UIKit/UIKit.h>