的XCode将构建“调试”,但不是“释放”,因为“ -Swift.h”头没有被发现
问题描述:
天儿真好,的XCode将构建“调试”,但不是“释放”,因为“<Module> -Swift.h”头没有被发现
这真是笑死我了我的框架,项目的基础没有错误或警告调试配置,但是当我尝试构建归档时,它失败,因为找不到<Module>-Swift.h
。显然它不是在这个配置中生成的。
有时当发生这种情况时(在调试中)我可以删除对swift头文件的引用,编译然后放回然后重新编译来修复它。这对于构建Release版本没有帮助。
所有的swift相关的构建设置与Debug相同。
以下是构建日志中的错误示例,请注意,文件LBImageView.swift不会导入除Foundation之外的任何内容。它没有提及到DRHExperimentData
类:
CompileSwift normal x86_64 /Users/l.walsh/Documents/Developer/LabBot/LBImageView.swift
cd /Users/l.walsh/Documents/Developer/LabBot
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/l.walsh/Documents/Developer/LabBot/LBImageView.swift /Users/l.walsh/Documents/Developer/LabBot/LBSize.swift /Users/l.walsh/Documents/Developer/LabBot/LBDataMatrix.swift /Users/l.walsh/Documents/Developer/LabBot/LBCalibratedPair.swift /Users/l.walsh/Documents/Developer/LabBot/LBExtensions.swift /Users/l.walsh/Documents/Developer/LabBot/LBExperimentDelegate.swift /Users/l.walsh/Documents/Developer/LabBot/LBGridView.swift /Users/l.walsh/Documents/Developer/LabBot/LBPoint.swift -target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -I /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/BuildProductsPath/Release -F /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/BuildProductsPath/Release -g -import-underlying-module -module-cache-path /Users/l.walsh/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/LabBot-generated-files.hmap -Xcc -I/Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/LabBot-own-target-headers.hmap -Xcc -I/Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/LabBot-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/LabBot-project-headers.hmap -Xcc -I/Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/BuildProductsPath/Release/include -Xcc -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/DerivedSources/x86_64 -Xcc -I/Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/DerivedSources -Xcc -ivfsoverlay -Xcc /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/unextended-module-overlay.yaml -Xcc -working-directory/Users/l.walsh/Documents/Developer/LabBot -emit-module-doc-path /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/Objects-normal/x86_64/LBImageView~partial.swiftdoc -O -module-name LabBot -emit-module-path /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/Objects-normal/x86_64/LBImageView~partial.swiftmodule -serialize-diagnostics-path /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/Objects-normal/x86_64/LBImageView.dia -emit-dependencies-path /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/Objects-normal/x86_64/LBImageView.d -emit-reference-dependencies-path /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/Objects-normal/x86_64/LBImageView.swiftdeps -o /Users/l.walsh/Library/Developer/Xcode/DerivedData/LabBot-hjckzfsxfeqqsxdbhfipevwfcmkx/Build/Intermediates/ArchiveIntermediates/LabBot/IntermediateBuildFilesPath/LabBot.build/Release/LabBot.build/Objects-normal/x86_64/LBImageView.o
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/l.walsh/Documents/Developer/LabBot/LabBot.h"
^
/Users/l.walsh/Documents/Developer/LabBot/LabBot.h:16:9: note: in file included from /Users/l.walsh/Documents/Developer/LabBot/LabBot.h:16:
#import "DRHExperimentData.h"
^
/Users/l.walsh/Documents/Developer/LabBot/DRHExperimentData.h:12:9: error: 'LabBot/LabBot-Swift.h' file not found
#import <LabBot/LabBot-Swift.h>
^
<unknown>:0: error: could not build Objective-C module 'LabBot'
有没有人经历过这个,解决了呢?有没有人有任何想法?
感谢您对此的任何帮助, 李。
答
所以事实证明,你不能#import
Swift模块头成obj-c .h文件,你必须把它们放在.m文件中。因此我从class.h中删除了#import <LabBot/LabBot-Swift.h>
并将其放入.m文件中。问题解决了。
请注意,如果您的界面引用了您要导入的Swift模块中定义的类,则需要在.h文件中使用@class
语句。
不幸的是,出于某种原因,XCode让我在为Debug构建时将模块头导入到.h文件中。它只在构建Release时吐出假人。此外,XCode不会抛出与有问题的obj-c类有关的错误,它会抛出与包含Swift模块的一部分类有关的错误。
也许有一个建立设置停止让调试允许这个(或允许发布允许它),但我找不到它。
验证您的“标题路径”在生成设置,调试模式 –
@HoaParis我不确定您指的是哪个设置。没有设置调用“标题路径”。包括搜索路径和接口路径在内的所有各种路径看起来都是正确的,并且对于调试和发布设置也是一样 – Tangler
我的意思是在“编译设置”中为您的应用程序在XCode中的“标题搜索路径”。 –