CharleyXIV
CharleyXIV

Reputation: 1610

Azure Mobile Service Offline Data Sync - Error on pullWithQuery

I am using Azure Mobile Service as a backend. Data structure is implemented and I tested CRUD calls using Fiddler. Everything seems right.

Then I implemented offline data synchronization with a client iOS device. Btw I followed this tutorial: https://azure.microsoft.com/en-gb/documentation/articles/app-service-mobile-ios-get-started-offline-data-preview/

My problem is when I try to synchronize data using the pullWithQuery function. I get this errror:

2015-08-19 11:36:12.525 Hykso[1820:330268] Logged in as Facebook:10155931659265500
2015-08-19 11:36:30.285 Hykso[1820:330522] ERROR Error Domain=com.Microsoft.WindowsAzureMobileServices.ErrorDomain Code=-1302 "{"message":"An error has occurred."}" UserInfo=0x14671c30 {NSLocalizedDescription={"message":"An error has occurred."}, com.Microsoft.WindowsAzureMobileServices.ErrorResponseKey=<NSHTTPURLResponse: 0x14584de0> { URL: https://hyksomobileservice.azure-mobile.net/tables/Athlete?$top=50&__includeDeleted=true&$skip=0&__systemProperties=__createdAt%2C__updatedAt%2C__deleted%2C__version } { status code: 500, headers {
    "Cache-Control" = "no-cache";
    "Content-Length" = 36;
    "Content-Type" = "application/json; charset=utf-8";
    Date = "Wed, 19 Aug 2015 15:36:28 GMT";
    Expires = 0;
    Pragma = "no-cache";
    Server = "Microsoft-IIS/8.0";
    "X-Powered-By" = "ASP.NET";
} }, com.Microsoft.WindowsAzureMobileServices.ErrorRequestKey=<NSMutableURLRequest: 0x14657830> { URL: https://hyksomobileservice.azure-mobile.net/tables/Athlete?$top=50&__includeDeleted=true&$skip=0&__systemProperties=__createdAt%2C__updatedAt%2C__deleted%2C__version }}

I just tested the same get call using Fiddler and I get this message:

exceptionMessage=The specified type member 'Version' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.

Does anyone have some advice to give me in order to debug this? Thank you!

Upvotes: 1

Views: 539

Answers (2)

lindydonna
lindydonna

Reputation: 3875

(First off, make sure you use the Mobile Services topic, not Mobile Apps topic. For this article they are very similar, so that's not your issue.)

The error looks really strange, and it points to something wrong with your server setup. Your client is sending a query asking for the system properties __createdAt, __updatedAt, __deleted, and __version, but somehow the "version" part is being translated into an invalid LINQ query. If you remove the ms_version column from your Core Data model, then version won't be requested, but then you can't do any conflict handling.

Based on the EF error message, you must be using the .NET backend. What happens when you test with the default TodoItem type that's in the server project? Your data class needs to extend EntityData to ensure everything is mapped correctly. (You can use ITableData, but that's more advanced.)

In terms of debugging, you can run the server project locally on IIS express and set a breakpoint after hitting the endpoint via Fiddler. You can also use remote debugging to go to your actual remote service.

For tutorials on this, see:

Upvotes: 1

nimatra
nimatra

Reputation: 614

Are assigning any value to the Version column in your data? I developed my app with C# and had a similar problem. There were two constraints about Version. First, don't touch it on the client just define it in your model and never assign to it. Second, in C# we need to define it this way

[Version]
public byte[] Version { get; set; } 

I don't know the equivalent of [Version] in Objective-c

Upvotes: 0

Related Questions