Objective-c中CoreData的自动索引 [英] Auto Index for a CoreData in Objective-c

查看:138
本文介绍了Objective-c中CoreData的自动索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须为每个核心数据记录生成唯一的ID,有没有办法在核心数据中设置自动增量索引?这样我们纯sqlite!

I have to generate a unique id for each of my core data records, is there any way to set an auto incremental index in core data? Such us pure sqlite! If not, what could be the best strategy to manage this?

推荐答案

有NSManagedObjectID

There is NSManagedObjectID

NSManagedObjectID *moID = [managedObject objectID];

但为什么不只是搜索?
创建唯一ID对于iPhone上的Core Data程序

But why not just to search? Creating a unique id for a Core Data program on the iPhone

这篇关于Objective-c中CoreData的自动索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆