Start a new topic

SyncAsync is ignoring query for iOS

Hi guys

I tried to use query parameter for dataStore.SyncAsync but it does not seem to work on Xamarin.

REST API URL does not show any query.

Is this a bug?


Hello Slava,

I have a few questions and requests to help us investigate this problem for you.

Please send me the KID of your app to I think it's the P*** F***** app, correct?

What version of the Xamarin SDK are you using when you encounter this problem.

When it doesn't work, are you seeing any error codes or messages or anything else that might help us understand what you are encountering? Perhaps a screenshot might help of the error.

Can you please post a code snippet of the function you are using when you encounter this error including the query itself?

Can you also share the URL that you mention that is not showing in the query?

We look forward to hearing back from you.


Billy Gee

Hi Billy

This is the other app, "DM"

I have got version 3.0.5 of Xamarin SDK.

I have got this in my code:

var query = from e in dataStore
 where e.creator_id == KinveyHelper.activeUser.Id
 select e;
 var response = await dataStore.SyncAsync(query);

But in the log I see this:

2017-05-03 14:31:46.897 UnitTests[24807:4386104] KINVEY: ------------------------REQUEST

2017-05-03 14:31:46.898 UnitTests[24807:4386104] KINVEY: GET ->

2017-05-03 14:31:46.900 UnitTests[24807:4386104] KINVEY: user-agent -> xamarin-kinvey-http/3.0.5

No query in URL


Hello Slava,

We have two questions.

  1. Are you using `DataStoreType.SYNC` as a data store type?
  2. Please try a `FindAsync(query)` call on the same data store with the same query and let us know if it does or does not have the REST URL query in it?

The `SyncAsync` call is making a `PushAsync` call followed by a `PullAsync` call.  Perhaps there is an issue with the `PullAsync` portion. We are trying to reproduce the problem back here. We will update you as soon as we have something more to share. Until then, we look forward to hearing back from you with answers to the above questions.


Billy Gee

Hello Slava,

We have successfully reproduced this problem and we know what needs to be done to fix it. This should be fixed in the next release of our Xamarin SDK.

In the meantime, we believe that there is a workaround that might help you. I have already mentioned it in my last update as something to try.

Instead of calling `SyncAsync(query)`, try calling `PushAsync()`, followed by calling `PullAsync(query)`. This should be a reasonable workaround until this problem is fixed in the next version of the SDK.

Please let us know if you have any questions.


Billy Gee


Thanks for a quick response.

Yes, the workaround helped to a point - I can see a query now.

More issues:

1. If I use a boolean in my query PullAsync does not work

This query

var query = from e in dataStore
 where e.creator_id == KinveyHelper.activeUser.Id || e.is_public
 select e;
does not emit a call at all - I see nothing in the log

This query

var query = from e in dataStore
 where e.creator_id == KinveyHelper.activeUser.Id || e.is_public == true
 select e;

 emits an incorrect URL, it should be "True" or true:

GET ->{"%24or":[{"creator_id":"5900a7f6c8ad28df6607df08"}%2C{"is_public":True}]}

2. If I use the below query the call is not emitted at all

var query = from e in dataStore
 where e.ACL.Creator == KinveyHelper.activeUser.Id
 select e;

I was also wondering if I could use FindWithMongoQueryAsync instead of PullAsync or had a PullAsync overload that takes MongoDB query string.

This would give me all the flexibility I need.


And another problem

If I use any query with PullAsync, even if I add it to a PreFetch hook,

when I create a new object I get all the collection fields empty except the default Entity fields.

All I do is this:

 await dataStore.SaveAsync(item);
 await dataStore.PushAsync();
 var query = from e in dataStore
 where e.creator_id == KinveyHelper.activeUser.Id
 select e;
 await dataStore.PullAsync(query);

If I remove query parameter all the fields are populated correctly

As it appears, the last issue is not related to SyncAsync (which explains why it was failing even with a preFetch hook).

It looks like if I supply my own _id, only basic Entity fields are populated.

Not sure if this is by design.


Hello Slava,

Please create a new post for this new problem so we can keep the original problem and engineering escalation separate from this new one. While you're doing that we will begin investigating this new problem.


Billy Gee

Hello Slava,

I have an update for you. The fix for the original problem that you described in this post regarding SyncAsync ignoring query for iOS is being fixed and should be available in the next release which should be within the next two weeks, possibly sooner.

We will confirm when the release is available for download or if the target release changes.


Billy Gee

Thanks Billy

What about the other issue? 


Hello Slava,

I just responded to your last inquiry in the Forum post that represents that problem, 

Please let us know if you have any questions.


Billy Gee

Hello Slava,

A new version of the Xamarin SDK is available for download that should resolve this problem. It is Xamarin SDK v3.0,9. You can find it available at the following URL.

Please download and test it at your convenience.


Billy Gee

Thanks Billy

I have updated to the latest version.

For some reason this adds dozens of additional libraries to my project (see below).

Why is this so?

 <package id="Microsoft.NETCore.Platforms" version="1.0.1" targetFramework="xamarinios10" />

  <package id="Microsoft.Win32.Primitives" version="4.0.1" targetFramework="xamarinios10" />

  <package id="NETStandard.Library" version="1.6.0" targetFramework="xamarinios10" />

  <package id="Newtonsoft.Json" version="9.0.1" targetFramework="xamarinios10" />

  <package id="PubnubNetPlatform" version="" targetFramework="xamarinios10" />

 <package id="System.AppContext" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Collections" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Collections.Concurrent" version="4.0.12" targetFramework="xamarinios10" />

  <package id="System.Console" version="4.0.0" targetFramework="xamarinios10" />

  <package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Diagnostics.Tools" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Diagnostics.Tracing" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Globalization" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Globalization.Calendars" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.IO" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.IO.Compression" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.IO.Compression.ZipFile" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.IO.FileSystem" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.IO.FileSystem.Primitives" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Linq" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Linq.Expressions" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Linq.Queryable" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Net.Http" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Net.Primitives" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Net.Requests" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Net.Sockets" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.ObjectModel" version="4.0.12" targetFramework="xamarinios10" />

  <package id="System.Reflection" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Reflection.Extensions" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Reflection.Primitives" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Reflection.TypeExtensions" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Resources.ResourceManager" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Runtime" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Runtime.Extensions" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Runtime.Handles" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Runtime.InteropServices" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.0.0" targetFramework="xamarinios10" />

  <package id="System.Runtime.Numerics" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Security.Cryptography.Algorithms" version="4.2.0" targetFramework="xamarinios10" />

  <package id="System.Security.Cryptography.Encoding" version="4.0.0" targetFramework="xamarinios10" />

  <package id="System.Security.Cryptography.Primitives" version="4.0.0" targetFramework="xamarinios10" />

  <package id="System.Security.Cryptography.X509Certificates" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Text.Encoding" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Text.Encoding.Extensions" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Text.RegularExpressions" version="4.1.0" targetFramework="xamarinios10" />

  <package id="System.Threading" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Threading.Tasks" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Threading.ThreadPool" version="4.0.10" targetFramework="xamarinios10" />

  <package id="System.Threading.Timer" version="4.0.1" targetFramework="xamarinios10" />

  <package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="xamarinios10" />

  <package id="System.Xml.XDocument" version="4.0.11" targetFramework="xamarinios10" />


Login or Signup to post a comment