综合技术

Xcode4: two entities with & ldquo; Required & rdquo; Relation and hellip&se…

微信扫一扫,分享到朋友圈

Xcode4: two entities with & ldquo; Required & rdquo; Relation and hellip&se…
0

EDIT: might be fixed in latest Xcode 4.0.2 (just released) – I’m downloading this out now, and will re-edit once I’ve tested it.

Create two entities (call them “Manager” and “Employee”, to stick with Apple’s docs).

Create a relationship, “worksFor” from Manager (1) to Employee (many), and mark it as “not optional”. (you’ll probably need to create 2 relationships, mark 1 as inverse of other)

Hook up an interface using IB, according to Apple’s original docs (NB: these don’t work any more, but here’s an almost exact recreation of the basic setup in Xcode4: http://rgprojection.blogspot.com/2011/04/xcode-4-and-core-data-macos-x.html
) and use Bindings (as described in the linked post) to create/add/delete the objects.

Now try to save. ERROR: “worksFor is a required property”.

In previous versions of Xcode, this worked as expected: you’d told Xcode that there was a bidirectional relationship, you told it that it was required, and so when it added the “Employee” to the “Manager”, it automatically hooked-up the inverse.

Has anyone else worked out how to make Xcode4 do what it’s supposed to? Is it an Xcode4 bug? I know that some of the CoreData support in Xcode4 has been deleted, with no replacement (yet), so I’m wondering if this has been deleted too?!

EDIT: here’s another project, one I made from scratch, same problem. Although (xcode4 bug, definitely!) this time I created the Relationship in the “grid” editor view rather than the “tree graphical” view… and the generated source code for objects was different
(should not be the case, obviously)

second project screenshot

EDIT2: StackOverflow was
showing the screenshot above, but has now removed it, you’ll have to click on the link. Sorry.

阅读原文...


Hello, buddy!

iPhone XS Max vs Galaxy Note 9 Drop Test Showdown: Which Flagship Is Easier to Break?

上一篇

IOException: Permission denied

下一篇

您也可能喜欢

评论已经被关闭。

插入图片
Xcode4: two entities with & ldquo; Required & rdquo; Relation and hellip&se…

长按储存图像,分享给朋友