Start a new topic

iOS SDK 3.3.5 Query Questions

I have two questions:

1) I have posted this question on Stack OF and has not received a response.  Refer to the link below:

2) When migrating to 3.3.5, I am replacing the old collection queries with the new syntax.  However, for some reason my queries are not pulling NSNumbers from the back end.  All my string fields are pulled when performing the query, but not NSNumber.  

I have tried both: find(byId) and Query().  However neither have worked.

Thanks is advance!

Addition to number 1) above:

I am having a similar issue related to the new ".save()". I use to be able to supply the old save function with an array of objects (now entities) and depending on the "id" it would either create new or update in the backend.  However, now the ".save()" will only take one object as an argument.  Is there anyway around this?


I was able to get results with this, let me know if the below works for you.

    let id:[String] = ["5855026650a816ec29012908","5855024a21400c5b492bea20"]

    let query = Query(format: "_id IN %@", id)

    dataStore.find(query) { data, error in
        if let data = data {
             print(“Data: \(data)")

        } else {
            print("fetching failed")





Thanks Pranav,

Unfortunately I still receive the same error:

'Invalid property name', reason: 'Property '_id' not found in object of type...'

The collection I am pulling from definitely has data and has an "_id" property.  So I am not sure why I am receiving this error if it is working for you.  I also had the additional questions in the first comment:

1) Did you have any input on the additional question on number 1 related to "Save()"?


2) I still am not able to retrieve NSNumbers in my queries.

Thanks again,


Update:  Per the Data Store Guide for iOS, by default the ".collection()" is of type "cache".  The "Cache" type will store data locally.  This must be why "Realm" is now included with the version 3x SDK.  Please see the resolutions based on question number below:

1)  I updated my DataStore collection to:

let store = DataStore<ClassName>.collection(.network)

I added ".network" to force the query to pull from the network rather than the cache file.  This actually identified "_id" as a property.  For some reason the "cache" file isn't storing this as a property.

2) Similar issue related to the "cache" query.  I reviewed the Realm support site as a last resort effort to try and figure this out.  I found that Realm doesn't actually support type "NSNumber".  

Excerpt taken from:

Realm supports the following property types: BoolInt8Int16Int32Int64DoubleFloatStringNSDate, and NSData.

Unfortunately, Kinvey doesn't support "Int" types.  As a work around, I have changed them to string and am just converting back to "Double" after I pull the data.  However, if I just use ".network" collection types, then NSNumber still works.




I am able to reproduce the issue and it has been escalated to engineering. I will get back to you once I have more information from engineering.



I am not able to fetch NSNumber, NSDate and NSMutableArray, even without caching (using .network). Strings work fine.  I am converting from iOS SDK 1 to 3 (because Kinvey has forced us to), and this issue makes the conversion impossible. Please fix!!!!

Hello James,

We recommend that you make the following change in the query syntax.

Replace the following line in your code...

     let query = Query(format: "_id IN %@", id)

With this...

     let query = Query(format: "entityId IN %@", id)

Please let us know if that helps you resolve the problem.


Billy Gee

1 person likes this
Login or Signup to post a comment