【发布时间】:2015-11-27 07:41:19
【问题描述】:
我正在使用 CRM Mobile SDK 在 iOS 中访问 MS Dynamics CRM,这是由 Microsoft 提供的,并且是 Objective-C 中的。我想在 Swift 中使用这个 sdk。我使用 swiftify 将示例 Objective-C 代码转换为 Swift,但它给出了错误。
无法使用类型为“(字符串,完成:(ADAuthenticationResult)-> Void)”的参数列表调用“loginWithEndpoint”
函数被调用是
- (void)loginWithEndpoint:(NSString *)serverURL completion:(ADAuthenticationCallback)completion;
这样称呼
CRMClient.sharedClient().loginWithEndpoint(host, completion: {(result: ADAuthenticationResult) -> Void in
if result.error {
// TODO: Handle the error
}
else {
// TODO: Do some work
}
})
根据示例函数会在objective-c中调用
CRMClient *client = [CRMClient sharedClient];
[client loginWithEndpoint:@"https://mydomain.crm.dynamics.com" completion:^(ADAuthenticationResult *result) {
if (result.error) {
// TODO: Handle the error
}
else {
// TODO: Do some work
}
}];
【问题讨论】:
-
我认为传入 loginWithEndpoint 函数的参数不匹配。
-
你能解释一下吗,因为我是 ios 的初学者
标签: ios objective-c swift