How could the example be changed to have a many to many relationship between devices and persons. I am interested in a case where a device could be shared among several owners. I would like the devices table to segue to a detail view that lists all the owners sharing the device with the % ownership for each person. The person table should segue to a detail view showing all devices shared by that person and the % ownership of each device by the person. I am thinking the data input for the owners could be handled by allowing multiple selections of owners from the device detail screen.
The main problem I am having is how to generate the table rows in one of the detail views showing all of the owners of a device and their % ownership or all of the devices owned by a person also with the % ownership.
Is this possible? Any help would be greatly appreciated. The many to many case does not seem to have any examples that I can find on the internet.
Hi @gofish, that’s a tricky one. If this were straight SQL I might add a second in-between relationship.
That means you’d have devices and persons. Then the third table would map device to person and have a percentage ownership field. It would be your responsibility to ensure that the sum of all mappings for a device add up to 100%.
You could do something similar in Core Data with three entities. There would be one more level of indirection here: once you have a device, you would look up the “owners” relationship, but remember, this won’t be Person objects anymore: they’ll be the special Mapping kind of object which will then have an ownership percentage and a reference to an owner.
That’s the first idea that comes to mind but I’m sure there are other ways to model this. I hope this helps!
That helps. I will try to set up a model like that.
The other thing I am stuck on is how to display a many to many instance in a table. for example (forgetting about the % owned) in the detail table for devices how do I display the owners. I don’t understand what the code should look like to display a cell for say device 2 in the device set and owner 1 for that device. Having a reference to one item of a set connected to an item of another set has me completely confused. I have tried printing out the values but I can not figure out how to use the results to make table cells.
Here is where I am stuck. I am using inventory as devices and customers as persons. This is from the viewWillAppear section of the inventory detail table view controller
let fud = self.inventory!.customer!.allObjects
print (“&&&&&&& 281 fud (fud)”)
this results in
I have assigned one inventory item to the customer “Flying Z” How can I put the names of the customers with owner relationships to the inventory item in the detail table for the inventory item. I can see the customer name in the print out but I can’t seem to find a way to get a reference to it that will work to populate a text item in a table cell.
The problem (I think) is that I don’t understand how to deal with the multiple sets created by the many to many relationship.
I’m having issues with the challenge finished downloads. They don’t show the results of how to complete the challenge. This isn’t the first one I’ve downloaded that was not completed. I would like to see if there were other ways of getting the results besides the code that I composed to reach my answer.
Hi, I am implementing core data in my project, reading bit by bit information but for some reason I am continuously getting fatal error because of managedobjectcontext. I have tried to use it exactly the same way as in 3rd lecture but no success Please if you can provide some idea it will realy be helpful
Hi @alakh, are you passing the Core Data stack along to your other view controllers? Since it’s set up as an implicitly-unwrapped optional, that’s the most common cause of crashes — the view controller accesses the stack property and it’s set to nil because the calling view controller didn’t set it in the prepareForSegue or elsewhere.
I just checked the privacy settings, and am not seeing anything abnormal. I tried viewing in Chrome and Safari and the video played normally.
Can you try refreshing the page, or viewing in a different browser and let me know if you are still having the issue. It’d help me to know what browser you are using when you have this issue.
@csweigart, I’ve been seeing this problem on my iPhone, since last Tuesday, for all the videos on the site. I normally only watch the videos on OS X, so it hasn’t been much of a problem, but it did not use to be this way.
@ibum and @jcatterwaul Thanks for letting me know what you are using. I’ve sent an inquiry to Vimeo about this. Hoping to hear back from them soon as to what’s going on here.
Hi, any updates on this? Videos that were available yesterday are becoming unavailable today. Am I going to be compensated for these outages? This is the second day.
Unfortunately the response we received from Vimeo says the only work around is to disable our privacy settings which we clearly can not do.
The problem affected Safari 9.1 for OSX and devices running iOS 9.3. This issue has been reported to Apple and Vimeo and they are working on a fix. The problem in Safari 9.1 is now reported as resolve and so you should be able to view our videos without incident on your Mac either in Safari or another browser.
Unfortunately, the issues in iOS 9.3.1 have not yet been resolved by Apple so the videos will likely still have issues if you attempt to play them on a device running iOS 9.3.1 (eg. an iPhone).
Please let me know if you are still experiencing issues with playback on your Mac and if so, what is the version of the browser you are running?
I’m still having this issue on an iPad 2 with iOS 9.3.1 and in Chrome for iOS. Same problem on an iPhone 6 - with iOS 9.3 on safari and chrome. Any news of a fix ? My subscription is not much good to me if I can’t watch the videos
The problem is due to and issue with iOS 9.3.1 and vimeo.com privacy settings. We use Vimeo to host all of our videos. Since iOS 9.3.1 is what you are running on your iPhone and iPad, then the videos may have issues with playback on those devices.
A fix is expected with iOS 9.3.2, but unfortunately, there’s no ETA on this as Apple does not announce in advance when it will release these updates.
Until this fix comes, the videos can be viewed on your Mac.
Hi Christine,
Thank you for the reply … I was able to find the core issue thread over at your video hosting vendor site … Help Center.
Unfortunately for me, I prefer to watch the videos untethered from my desk so iPad or iPhone as my options, I specifically updated the iPad to 9.3.1 as I thought it would solve this problem, but rather it locked it in :-).
This solved a problem I have been fighting for a week.
“Hi @alakh, are you passing the Core Data stack along to your other view controllers? Since it’s set up as an implicitly-unwrapped optional, that’s the most common cause of crashes — the view controller accesses the stack property and it’s set to nil because the calling view controller didn’t set it in the prepareForSegue or elsewhere.”
Greg, I went over the first 3 videos and read and did the challenges, And no where Did you explain, The PersonPicker??? What am I missing please??? And where did you explain on how we are able to implement the Person Picker when we assign the Device Owner ?? This has driven me crazy. I hope that you can point me where I missed your discussion on this implementation
Robert:unamused: