TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why iOS Devs Should Consider Using Core Data iCloud sync

32 pointsby zulfishahabout 12 years ago

9 comments

stevenweiabout 12 years ago
<p><pre><code> iCloud can resolve this problem by letting your users edit data offline and resolving any merge conflicts automatically (and in the case of iCloud Document syncing, giving you some options to get feedback from the user to help resolve the merge conflicts). If this worked seamlessly, it would add great value to your product. </code></pre> <i>If</i> it worked seamlessly, which it doesn't. Conflict resolution is very application specific, I'm not convinced that a one-size-fits-all automated solution will ever be able to handle the edge cases as well as the original developer, who has intimate knowledge of the problem domain and the structure of the data to be synced.<p><pre><code> App Store Features: you might get featured by Apple on the App Store for using their latest, greatest technologies. </code></pre> Don't think this is relevant for iCloud anymore. Besides, Apple has featured <i>tons</i> of apps that do their own proprietary sync or use Dropbox for syncing. (e.g. Evernote, Omnifocus, 1Password). The quality of the app is much more significant than the APIs it uses.<p><pre><code> Future Plans to move to Android / Web: a legitimate concern. But why not wait till your iOS product has grown big enough to have substantial demand for Android and/or Web, and develop your custom back-end solution then? </code></pre> Migrating your user's data off iCloud one year later is going to be a massive, massive pain to deal with. And database syncing is not like file syncing, it won't be trivial to integrate another syncing mechanism into the application. Things will start to get quite messy if you also want to interleave iCloud in there for backwards compatibility.
评论 #5467639 未加载
jchrisaabout 12 years ago
There are a lot of alternatives to iCloud. Most of them are just backend-as-a-service, but some of them are really sync engines. Dropbox has been around a long time, and is really popular for iOS file sync.<p>My team at Couchbase has been building mobile NoSQL databases that sync[1], for a number of years now, and our tech is used by a few apps in the app store already.[2]<p>This preamble is to say that I've had plenty of conversations with developers who would be in iCloud's target market but decided not to use it. And the big reason they won't use it has very little to do with the reliability and user experience problems that keep coming up in the critiques of iCloud. The big reason they don't use it, is that they need to control their data.<p>It's one thing for a small game or journaling app to outsource data management to Apple, but an entirely different thing for medical apps, enterprise sales, or other "serious" apps to do that. Perhaps in the long term Apple will offer an enterprise version of iCloud that you can run on your own terms. But until that happens, most serious apps are going to want to run their own infrastructure.<p>BTW all the code we write is open source, so if you are interested in sync capable databases with offline and p2p support, join us. [3]<p>[1] <a href="https://github.com/couchbase/couchbase-lite-ios" rel="nofollow">https://github.com/couchbase/couchbase-lite-ios</a> [2] <a href="https://github.com/couchbaselabs/TouchDB-iOS/wiki/TouchDB-In-The-Wild" rel="nofollow">https://github.com/couchbaselabs/TouchDB-iOS/wiki/TouchDB-In...</a> [3] <a href="https://groups.google.com/forum/#!forum/mobile-couchbase" rel="nofollow">https://groups.google.com/forum/#!forum/mobile-couchbase</a>
评论 #5467818 未加载
评论 #5467961 未加载
potatoliciousabout 12 years ago
The problems with Core Data iCloud sync are <i>vastly</i> understated in this article.<p>&#62; <i>"Yes, there are various problems"</i><p>Yes, chief among them that <i>it doesn't work</i>. I'm quite serious here. <i>No one</i> has gotten an iCloud-based Core Data store to withstand the actual multi-device usage it was designed for.<p>We're not talking about "works, but buggy". We're not even talking about "works but is a pain in the ass". We're talking "core features do not function". We're talking about "no known workarounds to bugs at the core of system that prevent it from working in any way that resembles the documentation".<p>And it hasn't worked since iOS 5.0, released almost two years ago. We have been through another major yearly update and <i>several</i> point updates, and <i>no</i> visible progress has been made on Core Data iCloud sync. The documentation has not improved, and with every point release developers go back and survey the situation only to find <i>more</i> bugs and <i>more and different</i> obscure error codes being emitted by the system.<p>Core Data iCloud sync would be bearable if it were just buggy. It would even be bearable if there was <i>forward momentum</i> on the vast amount of brokenness in it. But neither have demonstrated themselves.<p>But enough whining, let's address some points made by the article.<p>&#62; <i>"Or you can allow offline editing and build your own custom conflict-resolution solution, which I can guarantee will make YOU very unhappy... iCloud can resolve this problem by letting your users edit data offline and resolving any merge conflicts automatically"</i><p>Yes indeed, why build your own conflict-resolution layer, which you will probably get wrong in horrible ways, when you can rely on a working solution?<p>Poignant question if there <i>was</i> a working solution. Author is describing an iCloud <i>that does not exist</i>. Core Data iCloud Sync conflict-resolution <i>does not work</i>, and when it does not work, <i>it has failure modes which result in the irrecoverable corruption of your entire data store</i>, and in combination with other iCloud bugs results in the <i>complete inability for your app to edit its iCloud bucket ever again</i>.<p><i>Ever again</i>.<p>I wish I didn't have to use so much italics here, but the point really must be made.<p>&#62; <i>"even if your app has been terminated, the iCloud daemon can keep running and upload your data whenever it gets an opportunity"</i><p>&#62; <i>"with CDIS, data is pushed into your app when it’s ready"</i><p>Indeed, these are the points for using iCloud over other competing cloud sync services on iOS.<p>But that's a little like saying the Ford Pinto has a really nice tape deck. It has this really neat, really useful feature <i>when it isn't exploding</i>. It's like saying dinner service on the Titanic is great - none of this matters when you <i>can't even get the boat to float</i>.<p>&#62; <i>"And that they have really seasoned, very smart people working on that Core Data team. I can’t imagine Apple releasing something as ambitious as a distributed, decentralized database system without “thinking it through”."</i><p><i>But they didn't think it through</i>.<p>Author, you've been working with CDIS for the last two years. The technology behind it is neither mysterious nor is it secret. CDIS isn't broken because Apple can't write code. CDIS is broken because <i>it is architecturally unsound</i>.<p>Core Data iCloud Sync breaks down from a high level like this:<p>- You break each transaction into your database out as a diff. You store this diff in a directory that the iCloud daemon is syncing. Thus, all new diffs (called transaction logs by CDIS) are replicated to all devices. So far so good.<p>- It is trivially easy for a combination of devices (or really, just two) to generate a combination of diffs that <i>do not</i> playback to a consistent database state.<p>- In a normal world where CRUD operations are handled by a server with some understanding of the underlying data model, the server resolves conflicts as <i>the</i> authoritative data source, and thus consistency is maintained.<p>- In the world of CDIS, there is no authoritative server, nor is one device ever designated as the canonical state (this would be unrealistic, since devices get retired and lost, nor is there anything special about a device that makes it canonical). Instead, conflict resolution is left to each device, the implementation of which is broken. Which is to say, your CDIS-enabled database will work fine <i>until the moment two devices make conflicting changes</i>. At which point it is irrecoverably corrupted.<p>- The CDIS client's reaction to this is to revert your local copy of the database to its last known good state <i>and cease communicating with iCloud entirely</i>. This error occurs silently without either notification via UI (to the user) or API (to the developer). There is no way to query this state, and as of today the only visibility into this error is via console logging.<p>- Because the corruption has already occurred server-side, this means <i>all connected devices</i> using this store are all now disconnected from iCloud when using the app.<p>- As previously mentioned, there is no simple way to detect this error state via the API. Even if you <i>were</i> able to figure out that this has occurred, <i>there is no way to destroy your database and start over</i>. Due to bugs, lack of documentation, or architectural oversights, there is enough metadata about the database that the app cannot delete, that deletion of the store and its associated diffs do not put iCloud back to a clean state.<p><i>This</i> is why people are giving CDIS a lot of shit on the internet. Nobody seriously believes Apple is incompetent at programming, but even a mild dive into the underlying technology on which CDIS is based shows that this entire architecture is unworkable. It's not that <i>Apple</i> can't get it right, it's that they've committed to an architecture that <i>no one</i> can get right.<p>As someone who has spent the last few years neck-deep in iOS, who makes a living writing iOS apps, I <i>want</i> iCloud to work right. It is in my interest to cheer on Apple's every move. But short of <i>completely</i> scrapping their existing architecture I do not see how it can be meaningfully improved (read: made to actually work).<p>&#62; <i>"CDIS is a really compelling technology for many iOS / Mac developers to adopt in their apps, and you should be seriously looking at iOS6 or iOS7 as the point to jump onto the CDIS train if it fits your needs"</i><p><i>NO</i>. I for one would be <i>ecstatic</i> if CDIS works as advertised in iOS7, but <i>under no circumstances</i> should anyone consider using CDIS on an iOS6 device.<p>&#62; <i>"and it deserves less dismissiveness"</i><p>Dear author. We, the iOS developer community, have not acted with <i>dismissiveness</i> about CDIS. In fact we raced towards it with high hopes. We fought the scant documentation. We fought the bugs. We poured into the dev forums in droves. We helped each other and we shared our learnings.<p>We are angry now because we have <i>tried</i>. Nobody dismissed CDIS out of hand - the anger here comes from tens of thousands, if not hundreds of thousands, of collective man hours exhausted attacking this problem from every possible angle, and we are no further from where we were when CDIS first dropped in iOS5.<p>All of the points you make are valid in a universe where the technology you're talking about is <i>functional</i>. It would be <i>insanely great</i> to have a cloud-based data store that does conflict resolution for you, that updates in the background, that removes our responsibility for hosting it, that has no operational overhead on our part, and pushes instead of pulls. Indeed, those are all great reasons to use such a technology - <i>if it existed</i>.<p>But as it is no one can make a Core Data iCloud store stand up for more than an hour. And no one can recover a corrupt data iCloud database after it's fallen over. So unless you've figured out the solution to the above two problems, I'd kindly suggest that you stop treating the entire iOS developer base like ignorant, petulant children.<p>That was way longer and way angrier than I intended, but the article is really IMO nonsensical, and the author's tone that the iOS community has someone "dismissed" the technology or somehow not given it a fair shot, bothered me greatly.
评论 #5467718 未加载
评论 #5467858 未加载
评论 #5467830 未加载
drawkboxabout 12 years ago
I like iCloud but it is only an add-on sync option for most games we do as they are android/ios/web/desktop. A non fully cross platform cloud sync option just doesn't help speed up development much but it s a great low barrier sync for iOS only customers.<p>For iOS it is pretty easy though, anything in Docs gets synced if logged in and the app is setup for iCloud. It has always been a little touchy when they added the Caches/Documents requirements. You have to setup a no backup flag to prevent it from syncing if storing anything there which can be a problem if you store too much.<p><pre><code> BOOL success = [URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&#38;error];</code></pre>
sk5tabout 12 years ago
Hey Apple, why don't you get to studying on good old Lotus Notes? Multimaster, highly replicated, non-relational, conflict-reconciling, document-focused storage for what, twenty years?
评论 #5468341 未加载
zulfishahabout 12 years ago
Couldn't agree more than it's just badly implemented right now. It's at a "barely viable" stage right now. Article was meant to question the very assumption that it's a just a fundamentally bad idea to begin with, and all the negativity that's recently coming out in the press. Yes, it's not for every app or every situation, but it could be a great solution for a lot of apps (if only it worked a bit better!).
seivanabout 12 years ago
Again I hope people can separate Core Data and iCloud. Core Data works perfectly fine (though I suspect some will argue with me on that point, I've had no issues with it since 4)<p>But iCloud is just badly implemented for the moment. Will probably get better. Apple doesn't call iCloud beta, and people will probably be pissed since it doesn't work properly.<p>I suspect that if they did call it Beta, some might have had gone easy on it for all the faults out there.<p>I gave it a try when the API was accessible, I didn't like it, never looked back.<p>1)SSO can work with other form of social logins - and will also work from other platforms/clients<p>2) Privacy? As a developer you have access to those files<p>3) This works better if it's stored on a server that has a more public API since you probably want a web interface and etc.
thrushabout 12 years ago
Currently downloading the referenced app (Contacts Journal CRM) to see if the hype is real.
评论 #5467786 未加载
1010011010about 12 years ago
Perhaps the Google Drive Realtime API could be a substitute. <a href="https://developers.google.com/drive/realtime/reference/gapi.drive.realtime" rel="nofollow">https://developers.google.com/drive/realtime/reference/gapi....</a>