Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Really simple CoreData relationship but returns nil and null?

This bug has been busting me for the past 4 hours.

Also when I swap it round and get the User data first then Message data... the User.name will show, but the Message.message will not. So the data is definitely going in but the relationship between them seems to be broken.

enter image description here

like image 426
louisinhongkong Avatar asked Aug 30 '12 03:08

louisinhongkong


Video Answer


1 Answers

Firstly, +1 for the effort with the image you created to illustrate your problem.

The cause of your issue is that you never assigned the user to the message (or vice-versa).

Try

message.fetchUser = user;

or

user.fetchMessage = message;

Then save your context and perform the fetch request.

like image 169
Rog Avatar answered Oct 07 '22 15:10

Rog