Support Topics Documentation Slack YouTube Blog

Invalid fieldmapping argument when using loginWithFacebookSDK

I am trying to register/login a user using the facebook sdk but am receiving an invalid argument for the fieldMappings parameter that is causing the program to break.
I have a valid fbsdk token that i examine before i make the login call and the strange thing is that the user is generated on the backendless server. The Code and error can be seen here:

@try {
BackendlessUser *user = [backendless.userService loginWithFacebookSDK:token.userID
tokenString:token.tokenString
expirationDate:token.expirationDate
fieldsMapping:@{@“email”:@“email”, @“name”:@“name”}];
[MainThread executeOnMain:callback Worked:(user != nil)];
}
@catch (NSException *e) {
NSLog(@"%@",e);
}

*** -[NSDictionary initWithDictionary:copyItems:]: dictionary argument is not an NSDictionary

Hi Asher,
It is a little bit unclear case so I have a few things to say:

Regards Ilya

Hi Ilya,

what do you mean by minimize sample? The exception gets called when I invoke the function:

-(BackendlessUser *)loginWithFacebookSDK:(NSString *)userId tokenString:(NSString *)tokenString expirationDate:(NSDate *)expirationDate fieldsMapping:(id)fieldsMapping;

And I am not certain the problem is with the fieldMapping parameter I just read the exception and saw the problem was with a NSDictionary object. However it breaks while the code is executing the Backendless API so I am unable to confirm that theory.

I have tried setting the parameter to nil but it has not fixed the situation.

The problem appears to be the same as the one mentioined in the other thread but restarting my computer did not fix it.

Thanks,
Asher

Sorry, I meant ‘minimal’.
Anyway, I’ve created internal ticket to investigate this issue (BKNDLSS-15306)
We will let you know about our results.

Regards Ilya

ok please let me know if you need any other information

Hello Asher,

I’ve checked this issue and everything works fine. There is no problems with Backendless or Facebook SDK.
I’ve tested this code and that’s what I’ve got (screenshots):

- (IBAction)pressedLoginIntoBackendless:(id)sender {
 FBSDKAccessToken *token = [FBSDKAccessToken currentAccessToken];
 if (token) {
 @try {
 BackendlessUser *user = [backendless.userService
 loginWithFacebookSDK:token.userID
 tokenString:token.tokenString
 expirationDate:token.expirationDate
 fieldsMapping:@{@"email":@"email", @"name":@"name"}];
 NSLog(@"User logged in: %@", user.email);
 }
 @catch (Fault *fault) {
 NSLog(@"Fault: %@", fault.message);
 }
 }
}

Regards, Olga

Снимок экрана 2017-07-17 в 16.53.45.png