0

I am running a Kii Query that returns the expected number of results. However the results array contains object formatted as follow

"<KiiObject: 0x130471ae0>"

this is the output from

NSLog(@"%@",results);

I am confident that the Query is working correctly as i can add and remove objects from the bucket and the number of results in the array changes according, i just don't know how to take the results and get the corresponding object.

I have gone over everything in the Kii Doc's

link to Kii Docs

The result is to short to be the object id(uuid string) and i can't find any other reference in the docs that makes sense.

joffd
  • 521
  • 5
  • 19

1 Answers1

1

You can refer to bellow snippet

NSError *error = nil;

// Build "all" query
KiiQuery *allQuery = [KiiQuery queryWithClause:nil];

// Create an array to store all the results in
NSMutableArray *allResults = [NSMutableArray array];

// Create a placeholder for any paginated queries
KiiQuery *nextQuery;

// Get an array of KiiObjects by querying the bucket
NSArray *results = [bucket executeQuerySynchronous:allQuery
                                         withError:&error
                                           andNext:&nextQuery];
if (error != nil) {
  // Error handling
  return;
}
//obtain single KiiObject
KiiObject* firstObject = allResults.firstObject; // now you should get all the object properties 
NSLog(@"MaxScore : %@",[firstObject getObjectForKey:@"maxScore"]); //i.e to get "maxScore" value

Below is the links for querying KiiObjects. http://docs.kii.com/en/guides/ios/managing-data/object-storages/querying/