ios - 使用 Kii 查询结果

标签 ios objective-c xcode kiicloud

我正在运行一个返回预期数量结果的 Kii 查询。但是结果数组包含格式如下的对象

"<KiiObject: 0x130471ae0>"

这是

的输出
NSLog(@"%@",results);

我确信查询工作正常,因为我可以在存储桶中添加和删除对象,并且数组中的结果数量会相应变化,我只是不知道如何获取结果并获取相应的对象。

我已经阅读了 Kii Doc 中的所有内容

link to Kii Docs

结果是对象 id(uuid 字符串)的缩写,我在文档中找不到任何其他有意义的引用。

最佳答案

您可以引用以下代码片段

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

以下是查询 KiiObjects 的链接。 http://docs.kii.com/en/guides/ios/managing-data/object-storages/querying/

关于ios - 使用 Kii 查询结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37505141/

相关文章:

iphone - 无法在 iOS 中为对象设置值

ios - 如何将自定义 View 添加到 iOS VoiceOver 转子?

iOS 从 iphone 切换到 macbook safari/chrome

ios - Appcelerator - Xcode EULA 尚未被接受。启动 Xcode 并接受许可证

objective-c - 读取 AFNetworking 响应 header

ios - 在 iOS 应用程序中搜索

ios - Amazon S3 使用 Objective C 重命名对象

iphone - iOS 相当于 Android View.GONE 可见性模式

ios - 请求非结构或联合中的成员 tableView

ios - iOS 构建失败,线程 1 : signal SIGABRT on iOS 12. 4