In a Swift test bundle, I use the following line to get a class object of a class, which is defined in a dynamically loaded bundle (
MyPlugin). The bundle contains Swift and Objective-C code and is loaded successfully before the following command is executed:let aClass = NSClassFromString("MyPlugin.BackendAPIManager") as! BackendAPIManager.TypeWhen the test tries to execute the line, I get the following runtime error:
dyld: lazy symbol binding failed: Symbol not found: __TMaC16MyPlugin17BackendAPIManagerWhen changing the line to
let aClass = NSClassFromString("MyPlugin.BackendAPIManager") as! NSObject.TypeI can use
let apiURL = aClass.perform(#selector(BackendAPIManager.apiUrl(path:)), with: "/something")which means that the class is correctly loaded through the bundle, but somehow I cannot access the class through its name. The corresponding symbol is not found and I have no clue what could cause this. Any ideas?