Hi there,
I am looking to integrate the Twitter login to my app, and am just wondering if somebody could help convert the obj-c code (that i got from the code generation tool) into a more Swift friendly version. 
[backendless.userService easyLoginWithTwitterFieldsMapping:@{@"email":@"email"}
response:^(id response) {
NSLog(@"%@", response);
}
error:^(Fault *fault) {
NSLog(@"%@", fault.detail);
}];
Thanks!
Hi Simon,
How about this:
backendless.userService.easyLoginWithTwitterFieldsMapping( ["email":"email"],
response: {(result : NSNumbert!) -> () in
print ("Result: \(result)")
},
error: { (fault : Fault!) -> () in
print("Server reported an error: \(fault)")
})
seemed to have done the trick, thanks Mark!
Could you please confirm that easyTwitter login is working in current release ? I tried basic code mentioned above. Every time I run method -> it return result=1, but no user is logged in / registered. No login screen is presented (oauth/twitter app). Just immediate response -> result=1 and thats it. Nothing is happening. Could you please give me some advice ? Is there any way to make it in “non-easy” way if its not working properly -> using twitter SDK ?
Hi Tomas,
have you tried to generate and run Twitter login
project from Code Generation in console? Does this work for you?
Stanislaw
Hi thank you for reply, I tried it and it worked, so I investigaged it deeper and found couple of bugs and fix them. So to help others, here is summary:
- I have swift3 based iOS app, and whenever I try to use ASYNC approach I only get response:NSNumber = 1
- So I am using SYNC method which is properly opening SafariVC instance to perform oauth login with twitter
- Then there is another catch, if you have more social account like I have and they are not handled in “easy” way -> I am using normal FB SDK and google SIGN-In sdk you might end up in big mess. In my case these frameworks returned FALSE in open-URL method
- And finally whole login does not happen automatically, you have to call separate method: backendless.userService.handleOpen(url) which gives you eventually backendless user instance
- And by last, I could not get rid of presented VC at all, I thought that it’s going to be automatic, in case of succesful login, but it is not !!!
So yeah, its working, but documentation is realy, realy bad for this social login stuff
PS. do you have an idea why everyone is suggesting to map [“email”:“email”]? when there is no permission in twitter apps for email ? API is returning some sort of ID, not email address. And you need to ask twitter for some elevated permission to be able to get email address.
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #4f8187}
span.s1 {font-variant-ligatures: no-common-ligatures}
span.s2 {font-variant-ligatures: no-common-ligatures; color: #000000}
span.s3 {font-variant-ligatures: no-common-ligatures; color: #31595d}