Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not build Objective-C module '_SwiftUIKitOverlayShims'

Tags:

swift4

xcode9

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

Showing Recent Issues

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'
like image 569
jem.lee Avatar asked Sep 20 '17 08:09

jem.lee


2 Answers

For me on Xcode 9.0.1 the solution has been the typical engineer solution:

  1. Clean the project
  2. Erase DerivedData
  3. Reboot computer
like image 118
buguibu Avatar answered Oct 24 '22 11:10

buguibu


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

  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.

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

like image 37
mrh.is Avatar answered Oct 24 '22 11:10

mrh.is