CORE DATA objectId不断更改 [英] CORE DATA objectId changes constantly

查看:148
本文介绍了CORE DATA objectId不断更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些数据,我导出到一个XML文件,并放在一个远程FTP服务器。

I have some data that I export into an XML file and put in a remote FTP Server.

我必须识别每个对象的唯一属性,

I have to identified each object with a unique attribute, it doesn't matter wich is, but must be persistent always => it can never change.

我不想创建一个唯一的属性,序列,序列等等。

I don't want to create a unique attribute, sequence, serial, etc.

我使用的是objectID,但每次使用它都会得到一个新的引用。

I'm using the objectID but every time I use it a get a new reference.

在对象被保存之前,它有一个'temporal id',但一旦保存,它就会得到确定的。

I know that before the object has been saved, it has a 'temporal id', but once it's saved, it gets the definitive.

我没有看到这个,从来没有。

I'm not seeing this, never.

当我导出时,只是获取所有数据并循环,总是我得到一个新的引用:

When I export, just fetch all data and loop, and always I get a new reference:

NSURL *objectID = [[personalDataObject objectID] URIRepresentation];

// some of id received for the SAME OBJECT (no changes made, saved, ...)
// 61993296
// 62194624

感谢,

r。

我使用%d而不是%@,现在返回的数据是:

I was using %d instead of %@, now the returned data is:

x-coredata://F46F3300-8FED-4876-B0BF-E4D2A9D80913/DataEntered/p1
x-coredata://F46F3300-8FED-4876-B0BF-E4D2A9D80913/DataEntered/p2


推荐答案

。你显示的数字应该是一个URI / UUID是方法,简称。

I think this maybe a reporting problem. The numbers you show that are supposed to be a URI/UUID are way, way to short.

它们应该像


UUID(通用唯一的
标识符),也称为GUIDs
(全局唯一标识符)或IIDs
(接口标识符)是128位的
值,保证是唯一的。 UUID
在空间和
时间是唯一的,通过组合
所特有的值生成
的计算机 - 通常是以太网
硬件地址 - 和值
表示
的数量自从十月以来的100纳秒间隔
15,1582在00:00:00。

UUIDs (Universally Unique Identifiers), also known as GUIDs (Globally Unique Identifiers) or IIDs (Interface Identifiers), are 128-bit values guaranteed to be unique. A UUID is made unique over both space and time by combining a value unique to the computer on which it was generated—usually the Ethernet hardware address—and a value representing the number of 100-nanosecond intervals since October 15, 1582 at 00:00:00.

用ASCII表示的UUID
的标准格式是用连字符分隔的字符串
,例如
68753A44-4D6F-1226-9C60-0050E4C00067。
十六进制表示看起来像
可能期望的,像一个数字
值的列表前面的0x。例如,
0xD7,0x36,0x95,0x0A,0x4D,0x6E,
0x12,0x26,0x80,0x3A,0x00,0x50,
0xE4,0xC0,0x00,0x67。要使用
UUID,只需创建它,然后
将结果字符串复制到
头文件和C语言源文件中。
因为UUID简单地表示为
一个字节数组,所以对于
不同的平台没有
的字节顺序考虑。

The standard format for UUIDs represented in ASCII is a string punctuated by hyphens, for example 68753A44-4D6F-1226-9C60-0050E4C00067. The hex representation looks, as you might expect, like a list of numerical values preceded by 0x. For example, 0xD7, 0x36, 0x95, 0x0A, 0x4D, 0x6E, 0x12, 0x26, 0x80, 0x3A, 0x00, 0x50, 0xE4, 0xC0, 0x00, 0x67 . To use a UUID, you simply create it and then copy the resulting strings into your header and C language source files. Because a UUID is expressed simply as an array of bytes, there are no endianness considerations for different platforms.

我认为你看到的是不同的值,因为你每次检查UUID时只得到一个片段,并且有一个不同的片段。表示为URI,它们应该看起来更像一个URL。它们绝对不会像一个整数。

I think you're seeing different values because your only getting a piece, and a different piece at that, each time you check the UUID. Represented as a URI, they should look more like a URL. They definitely won't look like an integer.

这篇关于CORE DATA objectId不断更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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