【发布时间】:2016-06-23 19:19:29
【问题描述】:
我在 Swift 中有一个类方法:
import Foundation
public class MyClass : NSObject{
class func registerDevice(userId uId: String, deviceId dId: String, pushServiceToken token: String) -> Void{ /*...*? }
}
然后我试图从 Objective-C 调用该函数,但我正在做一些事情。这是我正在尝试的:
[MyClass registerDevice: @"user id" deviceId: [UIDevice currentDevice].identifierForVendor.UUIDString pushServiceToken: registrationToken];
...但我得到了错误:
"没有已知的选择器'registerDevice::deviceId:pushServiceToken:'的类方法"
拨打这个电话的正确方法是什么?
【问题讨论】:
-
不,是,因为您使用了错误的选择器。这是“方法名称”,无论其参数类型如何。可能您必须在
registerDevice之后添加UserId左右。
标签: ios objective-c swift