【发布时间】:2017-05-31 12:36:44
【问题描述】:
我正在尝试将一个简单的字符串从 Swift 控制器传递到 Objective-C 控制器,但不幸的是它不起作用。
我得到的错误:
“EUIDViewController”类型的值没有成员“stringPassed”
Swift 代码发送字符串
let pvc = EUIDViewController(nibName: "ScannerViewController", bundle: nil)
if isHasCameraPermission {
pvc.stringPassed = "test"
present(pvc, animated: true, completion: { _ in })
}
Objective-C 代码接收字符串
@property (strong, nonatomic) NSString* stringPassed;
- (void)viewDidLoad {
[super viewDidLoad];
[self initOCR];
NSLog(@"String: %@", self.stringPassed);
}
更新:我将 #import "EUIDViewController.h" 放入了桥接头
【问题讨论】:
标签: objective-c swift string viewcontroller