Custom Class name

Hi,

I have an issue with a custom table, for an easier explanation I’ve tested and modified the sample F17DataPaging in order to reproduce this problem.

Let’s take the class “Restaurant” and say that in our Backend the table name is “Restaurants”, so from what I saw in other posts, I need to add this line just after the initApp :

[[backendless data] mapTableToClass:@"Restaurants" type:[Restaurant class]];

With this I should be able to use Restaurant juste like any other class but if you run the project with these changes, you will have an error when doing

restaurants = [restaurants nextPage]

The error : F17DataPaging[55046:3476293] Server reported an error: FAULT = ‘0000’ [Entity is not valid] <>
So is there any mistake in what I’m doing or is that a bug ?

Thanks.

What you’re doing looks reasonable. Looks like there is a problem related to the paging functions, since the original collection retrieval worked. Is that right?

Indeed, I could fetch the results, I think that, maybe, when it try to get the next page and there is no results the issue occurs.

Even when there is no data, you should not be getting that error. I will open an internal ticket for this.

Hi David,

Recently Backendless SDK libs were rebuilt with XCode 7.3.
You could update our BlogFeatureDay-iOS github workspace. I just check F17DataPaging sample, it works fine for me.

Also you could update latest Backendless SDK release in your projects using CocoaPods (3.0.12 release) or from ios-SDK github.

Regards,
Slava

David, this issue is reproduced, we let you know when it will be fixed.

This issue is fixed, you could update our BlogFeatureDay-iOS github workspace.

Also you could update fixed libs of Backendless SDK from ios-SDK github (CommLibiOS & backendless).

So it’s working with the sample and when I add my classes to the sample project but I can’t make it work with my project, I’ve added everything that was on the commit (hosturl, allow arbitrary loads, etc …) and it’s still not working.
If I don’t map the class it does work but whenever I try it on a mapped class I have the same issue.
After fetching my data for the first time I call this method :

NSString *test = [data getEntityName];

Where data is the BackendlessCollection. So test is nil where it should be the name of my mapped class if I’m not wrong.
An idea about this ?

I just fixed ‘getEntityName’ method (please, change backendless.a).

Property ‘entityName’ contains a class name (as NSString) of the objects in BackendlessCollection, method ‘getEntityName’ is its getter.
Method ‘type’ return the class of the objects in BackendlessCollection:

-(Class)type;
In case of the F17DataPaging sample entityName == ‘Restaurant’, i.e. your app class, not a table name.
If you need a mapped table name, you could use:
NSString *tableName = [[Types sharedInstance] typeMappedClassName:[data type]];
Where data is the BackendlessCollection.

Is it possible for you to send us your project (or some minimal part of it, which can be executed as is) to support@backendless.com, so that we can reproduce this on our side?

I use Pods but it’s the same.

I can’t send you the project but I will see if I can reproduce this problem inside the sample project (haven’t succeeded yet).
It’s too bad that I’m not able to find the origin of this issue since we can’t debug the *.a but could the *.m of a Model class play a role in this issue ? Same question but for methods prototypes, enums, typedef and imports.

You could update the fixed libs directly in your project Pod:

http://support.backendless.com/public/attachments/b82f77a4f34d30c785c2c2008b50841e.png&lt;/img&gt;