我的 Bridging-Header.h 中有:
#ifndef EXAMPLE_HEADER_H
#define EXAMPLE_HEADER_H
#import "com/example/MyObject.h"
#endif
Swift 编译器 - 代码生成也已更新,可在构建设置下引用此文件。
虽然桥头文件单独编译并与项目一起运行,但只要我尝试初始化一个对象,就像在 AppDelegate.swift 中一样:
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let example = ComExampleMyObject()
return true
}
我收到以下错误:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_ComExampleMyObject", referenced from:
type metadata accessor for __ObjC.ComExampleMyObject in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
关于出了什么问题的任何想法?