Xcode16打包Framework报错:缺失DarwinFoundation模块且禁用隐式模块
Xcode打包Framework时出现DarwinFoundation模块缺失错误
我的xcworkspace可正常构建并运行,但将项目打包为Framework时出现如下错误:
iPhoneOS18.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SystemConfiguration.h:28:10: fatal error: module 'DarwinFoundation' is needed but has not been provided, and implicit use of module files is disabled
错误详情
[15:20:35]: ■ [35m/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -ccl -Wundef-prefix\=TARGET_05_ -Wdeprecated-objc-isa-usage - Werror\=deprecated-objc-isa-usage -Werror\=implicit-function-declaration -o /var/folders/mjcrl7502s1bOnpvnmvtd2xsw0000gn/T/frameworks-yOch9inn/build/Pods.build/Release-iphoneos/NetReachManager.build/Objects-normal/arm64/NetReachManager.o -disable-free -emit-obj -0 it /var/folders/mjcr17502s1bgenpvnmvtd2xsw0000gn/T/NetReachManager-cabOc9.bc - target-abi darwinpcs -triple arm64-apple-ios9.0.0 -target-sdk-version\=18.0 -fno-modulemap-allow-subdirectory-search -02 -fembed-bitcode\=all -fobj c-msgsend-selector-stubs - disable-11vm-passes -finline-functions -Os -fdiagnostics-hotness-threshold\=0 -fdiagnostics-misexpect-tolerance\=0 [Om [15:20:35]: . [35mIn file included from ..../Classes/NetReachManger.m:8: [Om [15:20:35]: . [35mIn file included from ..../Classes/NetReachManger.h:10: [Om [15:20:35]: . [35mIn file included from export/Release-iphoneos/Reachability/Reachability.framework/Headers/Reachability.h:11: [Om [15:20:35]: . [35m/Applications/Xcode.app/Contents/Developer/Platforms/iPhone05.platform/Developer/S0Ks/iPhoneD510.0.sdk/Systemaibrary/Frameworks/SystemConfiguration.framework/Headers/SystemCo nfiguration.h:28:10: fatal module TarwinFoundation. is needed but has not been provided, and implicit use of module files is disabled [Om [15:20:35]: • [35m26 1 #include [Om [15:20:35]: • [35m1 ^ [Om [15:20:35]: • [35m1 error generated. [Om [15:20:35]: . [35mCompileC build/Objects-'
已尝试的解决方法
- 设置
autolink_frameworks = yes - 设置
allow_nonmodular_includes_in_framework_modules = yes
以上两种配置均无效。
相关代码
NetReachManager.m
8 #import <Foundation/Foundation.h> 9 #import <os/availability.h> 10 #import <Reachability/Reachability.h>
Reachability.h
9 #import <Foundation/Foundation.h> 10 #import <os/availability.h> 11 #import <SystemConfiguration/SystemConfiguration.h> 12 #import <netinet/in.h>
内容的提问来源于stack exchange,提问作者banna
相关产品推荐
相关产品推荐

