非LLVM用BQSobfuscator编译,fatal error: 'projectName-Swift.h' file not found

-Swift.h' file not found 这年头,遇到的坑,也不少。先提供几个常见解决方式。

1.检查oc引用swift里面,projectName-Swift.h 书写方式正确。-Swift,S大写。

2.Targets -> Build Setting  里面搜索Default module。确认为项目名,非app Display Name。并且项目名,最好不要有. -等特殊符号。

3.command点击-Swift.h,找不到,可以试试,new file -> HeaderFile -> 命名“projectName-Swift”,自动生成projectName-Swift.h文件了这时就可以找到-Swift.h里面内容。

我遇到问题(局部报错信息)

CompileC /Users/asiazhang/Library/Developer/Xcode/DerivedData/WitCarLoan-duerrvsucauscogriollbqbueuin/Build/Intermediates.noindex/ArchiveIntermediates/WitCarLoan/IntermediateBuildFilesPath/WitCarLoan.build/Release-iphoneos/WitCarLoan.build/Objects-normal/armv7/BasicInformationViewController.o WitCarLoan/ERP/Controller/BasicInformationViewController.m normal armv7 objective-c com.apple.compilers.llvm.obfuscator.1_0

    cd /Users/asiazhang/Desktop/WitCarLoan_12.25_SVN

    export LANG=en_US.US-ASCII

    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

    /Users/Shared/BQSobfuscator4/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-cache-path=/Users/asiazhang/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file

fatal error: 'XXXXX-Swift.h' file not found
#import "XXXX-Swift.h"
        ^~~~~~~~~~~~~~~~~~~~
4 warnings and 1 error generated.
Command /Users/Shared/BQSobfuscator4/bin/clang failed with exit code 1

我用的是BQSobfuscator做代码混编,不是LLVM,Xcode自带编译器。然后我BQSobfuscator报错,用LLVM好的,再切回来BQSobfuscator编译,也运行ok,没问题。皆大欢喜。

 你以为就这样完了,那我就没必要写博客了。后来发现偶发性,'XXXXX-Swift.h' file not found。

终端  find ~ -iname "*Swift.h"  找到

Library/Developer/Xcode/DerivedData/XXX-dwaqrskrucomxlhguefjezjsouej/Build/Intermediates.noindex/XXX.build/Debug-iphonesimulator/XXX.build/Objects-normal/x86_64/XXX-Swift.h

这个是直接找指定目录下文件,上面是找所有

find Library/Developer/Xcode/DerivedData/ZhiFu360-dwaqrskrucomxlhguefjezjsouej -name XXX-Swift.h -print

发现用LLVM编译,生成了XXX-Swift.h 而用BQSobfuscator编译没有生成。用真机模拟器时候,BQSobfuscator编译没生成缓存有,所以没问题。清~/Library/Developer/XCode/DerivedData缓存,就有问题。Archive就不会读取缓存,也生不成,找不到,Swift.h文件。所以一直不成功。最后没办法-Swift.h无法找到。项目文件下,新建一个命名-Swift得文件,copy一份Xcode生成的—Swift.h文件。暂时编译通过没问题。但是每次有所修改,上线得重新copy一份系统生成的-Swift.h文件内容。

发布了30 篇原创文章 · 获赞 16 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/Asia_ZhangQQ/article/details/79257109