Possible duplicate this question but I can't find the answer
My project is used Objective C
, and I create ui test in swift
.
Then I create a bridging header MyApp_Bridging_Header.h file like this:
#ifndef MyApp_Bridging_Header_h
#define MyApp_Bridging_Header_h
#import "MyService.h"
#endif /* MyApp_Bridging_Header_h */
And call the class in Swift
test:
func testApp() {
// singleton
var service = MyService.shared()
}
Xcode can regconize MyService
class, but when I run test, I get this error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MyService", referenced from:
objc-class-ref in MyAppUITests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there any idea to fix this error?