Bmob 之 列表查询
2024-08-28 18:59:35
查询列表,返回前20个数据:
//创建BmobQuery实例,指定对应要操作的数据表名称
BmobQuery *query = [BmobQuery queryWithClassName:className];
//按updatedAt进行降序排列
[query orderByDescending:@"updatedAt"];
//返回最多20个结果
query.limit = ;
//执行查询
[query findObjectsInBackgroundWithBlock:^(NSArray *array, NSError *error) {
//处理查询结果
for (BmobObject *obj in array) {
News *info = [[News alloc] init];
if ([obj objectForKey:@"title"]) {
info.title = [obj objectForKey:@"title"];
}
if ([obj objectForKey:@"describe"]) {
info.content = [obj objectForKey:@"describe"];
}
if ([obj objectForKey:@"phone"]) {
info.phoneNum = [obj objectForKey:@"phone"];
}
info.time = [_dateFormatter stringFromDate:obj.updatedAt];
[_infoMutableArray addObject:info];
} [_tableView reloadData];
}];
最新文章
- C# 调用Excel 出现服务器出现意外情况. (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT)
- [转]as3 算法实例【输出1 到最大的N 位数 题目:输入数字n,按顺序输出从1 最大的n 位10 进制数。比如输入3,则输出1、2、3 一直到最大的3 位数即999。】
- webform 中使用ajax
- 【Sort Colors】cpp
- json(gson) 转换html标签带来的麻烦
- Jquery的外部链接和编写样式
- excel筛选两列值是否相同,如果相同返回第三列值
- Jquery autocomplete 插件示例
- [LeetCode234]Palindrome Linked List
- 《.NET 编程结构》专题汇总
- poj 1411 Calling Extraterrestrial Intelligence Again
- java删除数组中的第n个数
- 《前端之路》之二:数据类型转换 &;&; 隐式转换 || 显式转换
- Python之常见算法介绍
- 007_Reverse Integer
- c++引用和指针的彻底理解
- Codeforces 978E:Bus Video System
- cube-ui
- OpenGL资料
- <;a>;, <;input>;, <;button>;的区分与何时使用