GeekBand极客班-iOS开发GeekBand

极客班iOS应用开发实战测试题二:同学录

2015-09-01  本文已影响662人  d30d9e0626b0

极客班iOS应用开发实战测试题二(8月31日)

习题:同学录

项目源码见 GitHub

1. 题目要求:

ClassmatesClassmates

2. 实际开发遇到的点:

// Updating Objects with primary keys
// This will make properties no settled be NULL
[GWClassmate createOrUpdateInDefaultRealmWithValue:newClassmate];

3.项目完成情况:

完成1.0:

2015-08-31 20:17:00

完成1.1:

把习题同学录的存储 Realm 换成 FMDB,午饭到16:00还没吃,我的学习新的知识的能力还比较低的。需要投入更多时间来学习了。

2015-09-01 16:09:00

完成1.2:

2015-09-01 20:00:00

完成1.3:

2015-09-02 18:20:47

完成1.4:

2015-09-06 11:43:19

Classmates v1.4Classmates v1.4

进行中1.5:

4. BUG

以下的代码提示越界错误:Terminating app due to uncaught exception 'RLMException', reason: 'Index is out of bounds.'可能的原因:

需要注意的是,写入操作会相互阻塞,而且其相对应的进程也会受到影响。这和其他的永久数据存储解决方案是一样的,所以我们建议你使用常用的,也是最有效的方案, 将所有写入放到一个单独的进程中。https://realm.io/cn/docs/objc/latest/

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"showDetail"]) {
        
        NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];
        GWCustomTableViewCell *cell = (GWCustomTableViewCell *)[self.tableView cellForRowAtIndexPath:indexPath];
        
        GWDetailViewController *vc = (GWDetailViewController *)segue.destinationViewController;
        
//        vc.userid       = cell.userid;
        vc.name.text    = cell.name.text;

    }
}

最终解决方法是修改 Custom Cell 中添加一个 UILabel 的 text 来存储 UUID,并设置为隐藏。并添加使用 Detail Disclosure 测试 NSLog UUID。具体的越界问题,还需要在研究。

5. Further Reading

上一篇 下一篇

猜你喜欢

热点阅读