On the first page of chapter 6, it states that many of the new APIs in iOS 5 are broken Can you elaborate on this? Specifically what is broken and what problems result. Given that many people still have original iPads and cannot upgrade them to iOS 6, it’s difficult to require iOS 6 for apps designed for the iPad. I’ve been using UIManagedDocument (but not iCloud after hearing too many horror stories about it) in iOS 5. I’m not creating any new child contexts and using the context it gives me on the main thread without real problems. I did have a few people have their data file disappear on them. I was occasionally doing a manual save and took those out along with a few other changes and so far no problems since. I could never reproduce the problem so I’d love to know if there are other issues I should be checking.
Thank you for your comments. There is going to be a detailed elaboration on the iOS 5.0 issues in the Introductory chapter. It is not yet ready for public release but it is coming :)
As for your use case specifically, The UIManagedDocument doesn’t give you anything that a normal/traditional Core Data stack can’t give you. The UIManagedDocument is really meant for iCloud and a document style application. You can use it the way you are but it has some pretty sharp edges. Sounds like you have been able to avoid them so far.
As for my advice regarding iOS 5.0. While I do feel that any new project should be targeting iOS 6.0, you can target iOS 5.0, just treat it like it is iOS 4.0 in the area of Core Data and avoid the new APIs that were introduced in 5.0.
Thanks Marcus. I look forward to reading the introductory chapter when it’s ready. In my case, it’s sort of too late as my app was released in July and is currently using UIMangedDocument. I used it because it seemed simple and thought I might want to add iCloud support in a future version. I don’t want to require iOS 6 since I know people are using it on the original iPad.
I’m trying to figure out if I should stop using UIManagedDocument and forget about ever adding iCloud support or if the problems will not affect me. It probably wouldn’t be more than a day’s work to change it so it’s not using UIManagedDocument, but if I don’t need to, I’ll just stick with it as long as I can avoid the problems.
Thanks for all of the info Marcus.
I just bought the book. I’m in the early stages of a Core Data project so I am interested in hearing more about the problems in iOS 5.0. The project I’m working on is targeting 5.1 and later. I am very interested in using the NSIncrementalStore for connection to a web-based API but that is one of the “new” APIs. More info on the iOS 5 topic would be welcome.
I just downloaded the beta 2 which says the content is complete, but you really didn’t elaborate on the issues in chapter 1 - just states what you said before - don’t use the new APIs in iOS 5 unless you are targeting iOS 6 or higher. Is UIManagedDocument broken? Or is it the performBlock/performBlockAndWait methods or the parent/child contexts in general that have problems?
My problem is I’ve got a UIManagedDocument app I wrote last December and it seemed to work fine for me (and still does), but it hasn’t for some of the people using it (although I can’t reproduce the problem they’re seeing - on iOS 5 or iOS 6).
I haven’t read the rest yet to see if you elaborated there (in your post you said you would in chapter 1), but I look forward to reading the rest of it over the next week or so.
Any more information would be greatly appreciated.
Hi Tom and Marcus,
I saw a link to this on Apple’s cocoa-dev mailing list. This gives more detail about the problems.
Marcus, do you have anything to add to that?
One of the changes I made in my app was to get permanent IDs after inserting new objects and it sounds like this solves many of the problems and would explain why I haven’t seen any new reports of the problem since making those changes.
I don’t have much to add to his comments. The one item that is still outstanding on his list is not a bug but a lack of understanding of how Core Data works internally. So I am not surprised that the radar associated with it has not been closed yet. It would require a major reworking of the internal structure of Core Data to clear it up.
Having sad that, his blog post does go into some nice details of the problems in iOS 5.0. I did not want to spend too much time on it because A) You can find it on the net and B) I do not want to waste your time or energy being negative about a great framework.
iOS 5 is in the past, soon it will no longer be an issue.
Until then, treat iOS 5.x as if it were 4.x and you are fine. If you must use the new features, tread with care.
The reason I buy books are that you usually can assume they are a more definitive answer than something you found on the net and usually they provide more details all in one place. I had been searching for more details on the issues and never found them until someone linked to that blog post on the cocoa-dev mailing list. It’s your book so it’s obviously your decision.
I don’t view pointing out the specific issues as being negative (especially since they are fixed in newer release), but it is important to know what exactly works and what doesn’t. If the original iPad could be updated to iOS 6, I would agree it’s not really important. Most people update their phones every 2-3 years, but I know lots of people still using the original iPad (and have specific requests from users not to require iOS 6 for my app because they want to use it on their original iPad).
And not related to your book, but I am disappointed in Apple not releasing an iOS 5 update to fix these very significant issues.
Something that I commonly do in your case David is to write a fork in the code, if 6.0 then use parent/child mocs, etc. If 5.x then use the older style.
If you abstract out the core data stack into a separate class then have two of them, it is a pretty easy fork. The performance will suffer on the older version but that is the price.
Thanks Marcus. Yes that would be a good approach and my guess is 4-8 hours of work for my app. I think I’ve resolved the issue by getting permanent IDs early in the process, but if anyone still has an issue, that’s probably what I’ll do.
|You must be logged in to comment|