OGeek|极客世界-中国程序员成长平台

标题: ios - 无法构建 Objective-C 模块 'CoreGraphics' [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:02
标题: ios - 无法构建 Objective-C 模块 'CoreGraphics'

我在尝试运行任何单元或 UI 测试时遇到以下错误。运行应用程序本身时不会发生。错误信息如下所示:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:10: note: while building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:
#include <CoreFoundation/CFBase.h>
     ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/CoreFoundation.h"
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:
#include <CoreFoundation/CFBase.h>
     ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:
#include <Block.h>
     ^
/Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/table/Block.h:10:10: note: in file included from /Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/table/Block.h:10:
#include "leveldb/iterator.h"
     ^
/Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/include/leveldb/iterator.h:18:10: note: in file included from /Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/include/leveldb/iterator.h:18:
#include "leveldb/slice.h"

/Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/include/leveldb/slice.h:21:10: error: 'string' file not found
#include <string>
     ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/CoreGraphics.h"
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8:
#include <CoreGraphics/CGBase.h>
     ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:10: error: could not build module 'CoreFoundation'
#include <CoreFoundation/CFBase.h>
     ^
<unknown>:0: error: could not build Objective-C module 'CoreGraphics'

我在 Swift 3.2 模式和 CocoaPods 中使用 Xcode 9。我正在使用 Firebase 和 FirebaseUI,它具有 leveldb 作为依赖项。可以看到错误首先在leveldb/slice.h中触发,找不到string文件。

到目前为止,我已经尝试了以下方法:

对于它的值(value),这是问题导航器中的错误: Error in Issue Navigator

有什么建议吗?



Best Answer-推荐答案


这看起来类似于 CocoaPods issue这已在 CocoaPods 1.4.0 中修复。没有为单元测试目标正确设置搜索路径。

尝试更新到 CocoaPods 1.4.0 beta 并重新运行 pod update

使用与所描述的here 类似的解决方法对于 leveldb 路径:

仅在 Build Settings -> Header Search Paths

下将 "${PODS_ROOT}/leveldb-library/include" 添加到您的测试目标

关于ios - 无法构建 Objective-C 模块 'CoreGraphics',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46871673/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4