【发布时间】:2017-05-21 04:55:00
【问题描述】:
我正在从 ObjectiveC 调用 Swift 函数
这些是我的简单代码
在我的目标 C 代码中
// mySwift class is put in delegate
[delegate testFunc]; // works well
int now = 10;
[delegate showCount:now]; //compile error
在我的快速代码中
class mySwift {
func showCount(nowpos: Int){
// my code
}
func testFunc(){
// it works well
}
我无法用这条消息编译它。
myObjC.m:171:19: No known instance method for selector 'showCount:'
如果我不使用变量(Make testfunction without variable),它工作得很好。
我猜是因为 Type (Int, and int)
我该如何解决这个问题??
【问题讨论】:
标签: objective-c swift