Xcode Swift 编译错误导入名称太长

Posted

技术标签:

【中文标题】Xcode Swift 编译错误导入名称太长【英文标题】:Xcode Swift compile error import name too long 【发布时间】:2016-11-28 09:45:24 【问题描述】:

这是我在尝试构建项目时遇到的错误。

Opening import file for module 'Swift': File name too long

这是正在运行的快速编译命令:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -filelist /var/folders/b7/c8z8dq8n6y5b1x29mx_p209w0000gn/T/sources-adfc78 -primary-file " /Users/james/Documents/workspace/fb-ios-recover/FitBugg/Model/Mock model/MockUser.swift" -target x86_64-apple-ios8.0 -enable-objc-interop -sdk /Applications/Xcode.app/ Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -I /Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator -F /Users/ james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator -F "\"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator /AFNetworking\"\"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/Bolts\"\"/Users/jame s/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/Bolts-Swift\"\"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/ Debug-iphonesimulator/FBSDKCoreKit\" \"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/FBSDKLoginKit\" \"/Users/james/Library/Developer/Xcode/ DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/FBSDKShareKit\"\"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/HexColors\"\"/ Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/JSQMessagesViewController\"\"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/调试-iphonesimulator/JSQSystemSoundPlayer\"\"/Users/james /Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/JTCalendar\"\"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator /MBProgressHUD\" \"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/NMRangeSlider\" \"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg -gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/Parse\"\"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/ParseCrashReporting\"\"/Users/james /Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/ParseFacebookUtilsV4\" \"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator /ParseLiveQuery\" \"/Users/james/Library/D开发者/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/ParseUI\"\"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/SocketRocket\ " \"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/THContactPicker\" \"/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/构建/产品/Debug-iphonesimulator/TSMessages\" \"/Users/james/Documents/workspace/fb-ios-recover/Pods/GoogleMaps/Frameworks\"" -enable-testing -g -import-objc-header /Users /james/Documents/workspace/fb-ios-recover/FitBugg-Bridging-Header.h -module-cache-path /Users/james/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options - Xcc -I/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg。 build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg.build/FitBugg-generated- files.hmap -Xcc -I/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg.build/FitBugg-own-target-headers.hmap - Xcc -I/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg.build/FitBugg-all-non-framework-target-headers.hmap - Xcc -ivfsoverlay -Xcc /Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/james/Library/开发人员/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg.build/FitBugg-project-headers。 hmap -Xcc -I/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Products/Debug-iphonesimulator/include -Xcc "-I \"/Users/james/Documents/workspace/fb-ios -recover/Pods/Headers/Public\"\"/Users/james/Documents/workspace/fb-ios-recover/Pods/Headers/Public/GoogleMaps\"" -Xcc -I/Users/james/Library/Developer/ Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg.build/DerivedSources/x86_64 -Xcc -I/Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/中间体/FitBugg.build/Debug-iphonesimulator/FitBugg.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -DCCOOAPODS=1 -Xcc -working-directory/Users/james/Documents/workspace/fb- ios-recover -emit-module-doc-path /Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg.build/Objects-normal/x86_64/模拟U ser~partial.swiftdoc -Onone -module-name FitBugg -emit-module-path /Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg.build /Objects-normal/x86_64/MockUser~partial.swiftmodule -serialize-diagnostics-path /Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg.build /Objects-normal/x86_64/MockUser.dia -emit-dependencies-path /Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg.build/Objects -normal/x86_64/MockUser.d -emit-reference-dependencies-path /Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzpxgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg.build/Objects -normal/x86_64/MockUser.swiftdeps -o /Users/james/Library/Developer/Xcode/DerivedData/FitBugg-gzp xgbmtwqvbozdkgabiahuiovrr/Build/Intermediates/FitBugg.build/Debug-iphonesimulator/FitBugg.build/Objects-normal/x86_64/MockUser.o

【问题讨论】:

感谢凯文 【参考方案1】:

通过查看您的日志,我发现 -F 选项后面的所有 \" 都很奇怪。

有没有可能在您的构建设置中,Framework search Paths 设置为 "$(inherited)" 而不仅仅是 $(inherited)(周围没有 "")?

【讨论】:

以上是关于Xcode Swift 编译错误导入名称太长的主要内容,如果未能解决你的问题,请参考以下文章

XCode6 Beta 中的编译器警告 - “速记外部参数名称”

Xcode 6.4 Swift 单元测试无法编译:“GPUImage.h 未找到”“导入桥接头失败”

无法导入桥接头 xcode 6.4

使用 Swift 5.1 编译的模块不能被 Swift 5.1.2 编译器导入

使用 Swift 4.0.3 编译的模块不能被 Swift 4.2.1 编译器导入

swift 4.2 的 Xcode 10 视觉识别问题