在Core Data中,应该用于NSManaged对象的URI属性类型是什么? [英] In Core Data, what is the URI property type on the NSManaged object supposed to be used for?

查看:125
本文介绍了在Core Data中,应该用于NSManaged对象的URI属性类型是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. 为什么需要URI类型?

  2. URI属性的等效Swift对象类型是什么?

  3. 我是否将URL存储在此属性中?

  4. 我是否曾经想过以这种方式存储另一个托管对象的URI,但是否与此有关?

此外,指向描述用法的任何Apple文档的链接也会很有帮助。

解决方案


为什么需要URI类型?


要存储URL。


URI属性的等效Swift对象类型是什么?


NSURL 等效的Swift是 URL


我是否将URL存储在此属性中?



我怀疑我曾经会想以这种方式存储另一个托管对象的URI,但是它是否相关?


可能,但可能不是一个好方法理念。关系会更好。尽管如此,在某些情况下这样做还是有意义的。


  1. Why would you need the URI type?
  2. What is the equivalent Swift object type for a URI property?
  3. Would I store a URL in this property?
  4. I'm doubtful that I would ever want to store the URI for another managed object in this way, but is it related?

Also, a link to any Apple docs that describe the usage would be helpful.

解决方案

In the WWDC 2017 "What's New in Core Data" session, one of the slides indicates:

Why would you need the URI type?

To store a URL.

What is the equivalent Swift object type for a URI property?

The Swift equivalent of NSURL is URL.

Would I store a URL in this property?

That is the purpose of the type.

I'm doubtful that I would ever want to store the URI for another managed object in this way, but is it related?

Possible, but probably not a good idea. A relationship would be better. Still, there might be cases where it makes sense to do this.

这篇关于在Core Data中,应该用于NSManaged对象的URI属性类型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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