Reputation: 86
I am using CRM Mobile SDK to access MS Dynamics CRM in iOS which is provided by Microsoft and that is in Objective-C. I want to use this sdk in Swift. I use swiftify to convert sample Objective-C code into Swift but it is giving an error.
Cannot invoke 'loginWithEndpoint' with an argument list of type '(String, completion: (ADAuthenticationResult) -> Void)'
Function is called is
- (void)loginWithEndpoint:(NSString *)serverURL completion:(ADAuthenticationCallback)completion;
called like this
CRMClient.sharedClient().loginWithEndpoint(host, completion: {(result: ADAuthenticationResult) -> Void in
if result.error {
// TODO: Handle the error
}
else {
// TODO: Do some work
}
})
According to sample function will be called in 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
}
}];
Upvotes: 1
Views: 131
Reputation: 86
There was an error in CRM SDK. SDK is properly running in objective-c but not in swift and after updating xcode to 7.1.1 and swift 2.1 error changed.
Decided to use soap authentication instead as it is easy to use and don't need azure account to connect to crm
Upvotes: 2