Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode 13.1: Undefined symbol: __swift_FORCE_LOAD_$_XCTestSwiftSupport

My app was running perfectly without any errors or warnings yesterday. But when I tried to run it today, the build failed - I haven't changed anything in the code:

Undefined symbol: __swift_FORCE_LOAD_$_XCTestSwiftSupport

How to fix this, and why would something like this occur suddenly when it was working before?

And this is an issue I've been experiencing with XCode a lot lately. My code will be running smoothly without any errors, but then XCode will randomly start throwing errors when I relaunch it at a different time - without making any changes in the actual code.

I have included some photos and the full text of those photos:

InventoryApp 3 issues
    Warning
        Could not find or use auto-linked library 'XCTestSwiftSupport'
        Could not find or use auto linked framework 'XCTest'
    Error
        Undefined symbol: __swift FORCE LOAD $ XCTestSwiftSupport

Photo

ld: warning: Could not find or use auto-linked library 'XCTestSwiftSupport'
ld: warning: Could not find or use auto-linked framework
'XCTest'
Undefined symbols for architecture arm64:
    "__swift_FORCE_LOAD_$_XCTestSwiftSupport", referenced from:
        __swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in Button.o
        __swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in ViewModel.o
        __swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in Inventory.o
        __swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in AddView.o
        __swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in ScannerView.o
        __swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in RegisterView.o
        __swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in ContentView.o
        ...
       (maybe you meant: __swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Photo

like image 845
ela16 Avatar asked Sep 13 '25 14:09

ela16


1 Answers

This condition also occurs if you add

import XCTest

to a file in a non-test bundle.

like image 185
Spiff Avatar answered Sep 15 '25 04:09

Spiff