Backendless Support
 
Cannot Reproduce

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

Leave a Comment

Comments (5)

photo
1

Hi Asher,

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

- please provide us a minimal sample to reproduce your issue;

- why are you sure that problem is in fieldsMapingparameter? Does your program work without fieldsMapping?

- recently we had something similar with another user (http://support.backendless.com/topic/backendless-4-0-ios-user-login-nsdictionary-initwithdictionarycopyitems), in that case rebooting of iMac helped.

Regards Ilya

photo
1

Hi Ilya,

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

  1. -(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

photo
1

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

photo
1

ok please let me know if you need any other information

photo
photo
1

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):

  1. - (IBAction)pressedLoginIntoBackendless:(id)sender {
  2. FBSDKAccessToken *token = [FBSDKAccessToken currentAccessToken];
  3. if (token) {
  4. @try {
  5. BackendlessUser *user = [backendless.userService
  6. loginWithFacebookSDK:token.userID
  7. tokenString:token.tokenString
  8. expirationDate:token.expirationDate
  9. fieldsMapping:@{@"email":@"email", @"name":@"name"}];
  10. NSLog(@"User logged in: %@", user.email);
  11. }
  12. @catch (Fault *fault) {
  13. NSLog(@"Fault: %@", fault.message);
  14. }
  15. }
  16. }

Regards, Olga