本文介绍了无法构建 Objective-C 模块“_SwiftUIKitOverlayShims"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xcode8.3.3项目中不会有问题,但是升级到xcode9后,编译器有问题!

In the Xcode8.3.3 project will not be a problem, but after upgrading to xcode9, the compiler has a problem!

显示最近的问题

CompileSwift 普通 arm64

CompileSwift normal arm64

/Users/leekexi/Documents/macsrc/mtom/modules/ScrollerRefresh/RefreshConst.swift
    cd /Users/leekexi/Documents/macsrc/mtom
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -filelist /var/folders/cz/jq8bwvds0j52yy2j0p7_2kf40000gn/T/sources-86be14 -primary-file /Users/leekexi/Documents/macsrc/mtom/modules/ScrollerRefresh/RefreshConst.swift -target arm64-apple-ios8.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk -I /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Products/Debug-iphoneos -F /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Products/Debug-iphoneos -F /Users/leekexi/Documents/macsrc/mtom/Pods/RongCloudIM/RongCloudIM -F /Users/leekexi/Documents/macsrc/mtom/modules -F /Users/leekexi/Documents/macsrc/mtom/modules/Live/IJKMediaPlayer -F /Users/leekexi/Documents/macsrc/mtom -enable-testing -g -module-cache-path /Users/leekexi/Library/Developer/Xcode/DerivedData/ModuleCache -swift-version 4 -enforce-exclusivity=checked -D DEBUG -serialize-debugging-options -Xcc -I/Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/mtom-generated-files.hmap -Xcc -I/Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/mtom-own-target-headers.hmap -Xcc -I/Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/mtom-all-target-headers.hmap -Xcc -iquote -Xcc /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/mtom-project-headers.hmap -Xcc -I/Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Products/Debug-iphoneos/include -Xcc -I/Users/leekexi/Documents/macsrc/mtom/Pods/Headers/Public -Xcc -I/Users/leekexi/Documents/macsrc/mtom/Pods/Headers/Public/RongCloudIM -Xcc -I/Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/DerivedSources/arm64 -Xcc -I/Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/leekexi/Documents/macsrc/mtom -emit-module-doc-path /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/Objects-normal/arm64/RefreshConst~partial.swiftdoc -serialize-diagnostics-path /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/Objects-normal/arm64/RefreshConst.dia -import-objc-header /Users/leekexi/Documents/macsrc/mtom/mtom-bridging.h -pch-output-dir /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/PrecompiledHeaders -pch-disable-validation -Onone -module-name mtom -emit-module-path /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/Objects-normal/arm64/RefreshConst~partial.swiftmodule -emit-dependencies-path /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/Objects-normal/arm64/RefreshConst.d -emit-reference-dependencies-path /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/Objects-normal/arm64/RefreshConst.swiftdeps -o /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Build/Intermediates.noindex/mtom.build/Debug-iphoneos/mtom.build/Objects-normal/arm64/RefreshConst.o -index-store-path /Users/leekexi/Library/Developer/Xcode/DerivedData/mtom-aecafhlecijtaebzvztitxjcabvr/Index/DataStore -index-system-modules

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "UIKitOverlayShims.h"
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/shims/UIKitOverlayShims.h:24:11: error: use of undeclared identifier 'UIFocusSystem'
  return [UIFocusSystem environment:environment containsEnvironment:otherEnvironment];
          ^
<unknown>:0: error: could not build Objective-C module '_SwiftUIKitOverlayShims'

推荐答案

此修复来自 提到的论坛帖子为我修复了它:只需删除有问题的代码!

This fix from the mentioned forum thread fixed it for me: Just delete the offending code!

  1. 打开错误指向的文件(对于大多数人来说,/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/shims/UIKitOverlayShims.h).
  2. 删除方法 _swift_UIKit_UIFocusEnvironmentContainsEnvironment 以及周围的编译器指令.
  1. Open the file the error points to (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/shims/UIKitOverlayShims.h for most people).
  2. Delete the method _swift_UIKit_UIFocusEnvironmentContainsEnvironment, plus the surrounding compiler directives.

在那之后我重建只是为了确定,但这可能没有必要.

I rebuilt after that just to be sure, but that might not be necessary.

这绝对是一种解决方法;希望这会在 Xcode 的未来版本中得到修复.

This is definitely a workaround; hopefully this will be fixed in a future version of Xcode.

这篇关于无法构建 Objective-C 模块“_SwiftUIKitOverlayShims"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 09:49