Entity with two relations to Users table

Hi Andres,

I checked on Android and could not duplicate the problem. I am attaching my sample project to this post. You will need to put your app id and secret key into LoginActivity.java. If you could run it and let me know, it would be great.

We’re checking on iOS now.

Regards,
Mark

BackendlessSamples.zip (1.36MB)

Hi Mark.

In your Android sample project, you are using asynchronous login. In previous comments i told you that this was working for me (problem was with sync method), but if it try to fetch user relationship data using sync method, it fails with the same error.

BackendlessException{ code: ‘Internal client exception’, message: ‘null’ }

I have tried to fetch user relationship data using asynchronous method and it works now. The article you posted last week only shows synchronous samples, and it is not working. Could you please check it? I think some async code examples would be great too.

About iOS problem, could you check it?

Regards,
Andrés

Andres,

I must’ve misunderstood you. I thought the problem was with the login method. I will check synchronous loadRelations call now.

As for the iOS, we’re investigating the problem.

Regards,
Mark

Hi Mark.

I may not have explained myself very well either. In fact, the original question in this thread was related to iOS SDK, but then i tried with Android SDK and got other problems.

In resume:

Android: synchronous methods are not working (login, loadRelations, etc.). Asynchronous methods are working ok.

iOS: currently is not possible to fetch all user relationship data. I only get the one-to-many.

Regards,
Andrés

Andres,

The reason you get failures with synchronous calls is because Android does not allow HTTP requests from the main thread. On Android your options are either to spawn a new thread and make a sync call or use the Backendless async API.

As for iOS, we’re still investigating - found a bug which is related to what you’re observing.

Regards,
Mark

Hi Mark.

You are absolutely right about Android. It was my mistake.

Regards,
Andrés

Andres,

Could you please try the following code which loads all relations for a user object:

[ backendless.userService login:@"tt@tt.tt" password:@"tt" response:^(BackendlessUser *u) {
        Fault *f;
        [ backendless.persistenceService load:u relations:@[@"*"] error:&f];
        NSLog(@"%@", f);
    } error:^(Fault *error) {
        NSLog(@"error");
    }];

Hi Mark.

I have tried your code and it works. Previously i was using this method:

-(id)findById:(NSString *)entityName sid:(NSString *)sid relations:(NSArray *)relations;

but i just have checked it is deprecated (as many other methods in iOS SDK). I will try the new ones.

Thanks for your help Mark!