G'天,
这实际上是在我的框架项目构建中杀死了我没有错误或警告的调试配置,但是当我尝试构建存档时它失败了,因为找不到<Module>-Swift.h
。显然它不是在这种配置中生成的。
有时当发生这种情况时(在Debug中)我可以删除对swift标头的引用,然后将build放回然后重建以修复它。在构建Release时,这无济于事。
所有swift相关的构建设置对于Debug和Release都是相同的。
以下是构建日志中的错误示例,请注意文件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'
有没有人经历过这个并解决了它?有没有人有任何想法?
感谢您对此提供任何帮助, 李。
答案 0 :(得分:1)
事实证明,您不能将#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模块一部分的类相关的错误。
也许有一个构建设置停止让Debug允许这个(或让Release允许它),但我找不到它。