English 中文(简体)
如何与3个关联实体使用核心数据设计
原标题:How to use Core Data design with 3 linked entities

我在从3个关联实体获取核心数据信息方面存在问题,其中一些工作有效,而有些工作不起作用。

Model
Entity        Accounts                RegDate
relationship   heldby  >> to-many >>  inAccounts
attributes     balance                 addDate
               name

Entity        RegDate                 Regster
relationship  regheldBy >> to-many >> inRegDate
attributes    addDate                 amount

当我这样做时:

Regster *regster = [self.fetchedResultsController objectAtIndexPath:indexPath];
cell.textLabel.text = regster.amount;
NSLog(@"Regster: %@  %@", regster.amount, regster.inRegDate.addDate);

regster. amount 显示预期值, 但 Regster. inRegDate.addDate null 显示正负值 。

当我这样做时:

RegDate *regdate = [self.fetchedResultsController objectAtIndexPath:indexPath];
cell.textLabel.text = regdate.addDate;
NSLog(@"RegDate: %@", regdate.addDate);

regdate.addDate displays the expected value, whereas previous example I get null. Additionally, I cannot get amount to display. I thought I could use: regdate.regheldBy.amount > but this give error "Property amount not found on object of type NSSet "

我不知道我做错了什么 我想我可能把关系安排得不对 我尝试过很多不同的东西

有什么想法吗?

最佳回答

这可能是因为没有为你们的所有关系 建立反向关系。

此外,由于 regdate.regraveBy 是多种关系, 它由包含 Regster 对象的一组物体来表示。 您可以在集上调用 amount , 您必须首先从集中选择一个 Regster 对象 。

问题回答

暂无回答




相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签