9

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'
HelenA
  • 96
  • 1
  • 11
jem.lee
  • 93
  • 1
  • 5

2 Answers2

13

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.

mrh.is
  • 184
  • 3
  • 13
  • I just commented on one of the statements, but I do not know if there is any impact – jem.lee Oct 08 '17 at 12:21
  • 1
    I get this error with Xcode 9.1. I silenced it by editing my module map/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/shims/module.modulemap to comment out the line header "UIKitOverlayShims.h" – Faisal Memon Nov 07 '17 at 11:03
  • This will actually get rid of the generic message and reveal the real underlying issues. In my case I had framework imports mixed in. @import and #import mixed in the same file that xcode did not like – Pacu Nov 07 '17 at 13:48
  • @mrh.is I cannot edit the `UIKitOverlayShims.h` file – lee Jun 20 '18 at 14:10
  • @lee I had to use a program other than Xcode. Then when you try to save, that program should prompt you for your admin password. – mrh.is Jun 22 '18 at 19:23
  • @mrh.is: could you tell me which program did you used to edit?(I used `TextWrangler` but couldn't save file). – lee Jun 25 '18 at 06:18
  • 1
    @lee I used Sublime Text. – mrh.is Jun 26 '18 at 16:48
5

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
BuguiBu
  • 1,507
  • 1
  • 13
  • 18
  • Helped me too - shouldn't be really surprised. – hybridcattt Dec 19 '17 at 13:17
  • No need to reboot the computed. Cleaning and rebuilding should do it too, maybe restart Xcode. If that fails, I'd delete DrivedData and only if that fails too, I'd restart the computer. – bauerMusic Jan 25 '18 at 09:51
  • 2
    Surprisingly enough, it seems that the reboot is necessary in some situations, like mine. I tried all versions of rebuilding, quitting xcode and deleting derivedData, nothing worked until I rebooted. My issue was with debugging in lldb, getting the shim errors. – possen Apr 20 '18 at 22:25
  • 1
    I can't believe the reboot was required... thank you! – Brian Redd Aug 19 '20 at 00:58