News for hackers. Stuff that matters.
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by gfodor on Thursday February 07, 2013 @06:34PM (#5185248)
it would be helpful if this article included some actual details about what doesn't work for people considering adding iCloud to their apps.
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by potatolicious on Thursday February 07, 2013 @07:34PM (#5185497)
iCloud in general "just works". It was pretty terrible from the get-go, from reliability to really egregious bugs in the OS, but at this point is pretty stable.

The real problem here is the combination of iCloud and Core Data (for non-Apple folks, the built-in persistence/object model framework).

In a somewhat simplified way, Core Data is a data store most commonly backed by SQLite. It's used everywhere from your mail app to the Facebook app. It's handy and convenient when it isn't trying to kill you - it's one of the more complex frameworks that Apple ships, and the documentation is extremely poor for it. It also doesn't help that there is a lot of quirky behavior that's more or less tribal knowledge to long-time Apple devs and WWDC attendees, and is has enough concurrency gotchas to fill a container ship.

So, Core Data is not the simplest piece of code to work with from the get-go, and then you pile iCloud on top.

iCloud is conceptually pretty simple - there's a directory on your file system that is replicated to Apple's servers, and back down to each one of your devices. When files change the OS sends notifications to your app informing you of such. If you're using iCloud as a distributed file system (a la Dropbox), it's easy to integrate.

The trouble with this model is that Core Data stores can be in fact quite large. If you have a 30MB database of, say, recipes on your disk, you really don't want to resend the whole thing every time your user alters a row. Apple special-cases Core Data stores in iCloud by sending only deltas, but the implementation is utterly broken:

- There is no baseline state(s). The database is literally the playback of every delta, with no canonical snapshots. Ever.

- iCloud is really bad at sequencing the deltas, especially if (somewhat) concurrent changes are happening. Core Data is also terrifyingly bad at conflict resolution when deltas from different devices don't line up.

- The above points means that it's trivially easy to break your entire database, as your deltas no longer play back to a sane database file. When this occurs there is no way to roll back your database, since there is no concept of a snapshot or last known good state.

- This is compounded by some really horrible API design on Apple's part. When your iCloud database becomes corrupt it fails silently, with absolutely no API that allows one to determine said broken state. Your app literally stops working with none of the OS making a single peep, and no way for you to proactively check your database's state. iCloud seems to print some debug things into your console indicating this failure, but neither your app nor your users have access to it. This manifests in your app (and in tech support requests) as "iCloud just stopped syncing" - your device stops transmitting deltas and simply works off of the last locally-cached good state, all without telling the dev or the user.

- This is further compounded by the fact that the entirety of Core Data+iCloud was rushed out the door. Documentation was non-existent even up to the day the new version of iOS went out to the public. There was literally only one source of information: a thread on the Apple dev forums that Apple engineers would sometimes pop into.

- This is further compounded by the fact that even the Apple engineers themselves seemed to have no idea how to implement an app with iCloud + Core Data. The example code (provided deep, deep within aforementioned thread) made 90 degree turns seemingly every few days. The same sample would have dramatically changing implementations from week to week. The Apple engineers in the thread seemed as mystified as the people trying to use the framework.

- The poor documentation and poor state of sample code, as well as what is IMO a fundamentally broken architecture means that iCloud + Core Data remains a complete nightmare to this day. I think the poor architecture is really the core of this here - while Apple could have provided better docs and better support, I believe the fundamental architecture choices made here means Core Data + iCloud would never have been workable.

- The icing on top of the cake was an extremely egregious bug that existed at launch (unsure now, you couldn't pay me enough money to work with that API ever again). "Okay, so our deltas are completely fucked" you say, "Why don't we just delete the app's entire iCloud bucket and start over?"

A jolly good idea until you realize that a bug in iOS/iCloud means that when you delete an app's iCloud storage "bin", it cannot be recreated by that app, ever again.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by cageface on Thursday February 07, 2013 @09:02PM (#5185857)
A lot of the more recent iOS core apps and APIs seem either poorly conceived or implemented, or both. Auto Layout is a train wreck. Storyboards seem like a nice idea until you really start using them, Core Data + iCloud horror stories abound. Maps was a fiasco etc.

Cocoa Touch + Obj-C is a very nice platform in a lot of ways but I'm losing faith in Apple's software architects. Contrast this with Android and even though I think Java is a poor choice for mobile development their engineering teams really seem to know what they're doing.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by fpgeek on Thursday February 07, 2013 @09:16PM (#5185901)
Java was a great choice for the technical goals the Android engineering team was trying to achieve (cross-architecture portability, easier transition for non-mobile developers, etc.). The problem was that those technical goals turned out to be not very helpful in terms of meeting Android's strategic goals, given the way the mobile OS/device market has evolved.

That's a mistake at a level above engineers and software architects (or at least a mistake so far - if, hypothetically, Intel managed to crack their mobile CPU problem the choice of Java would turn out to be very smart). This is the dual of Apple's situation with iCloud. The strategic choice to start building out cloud services to support their ecosystem is clearly the right one, it is the implementation that has missed the mark (so far).

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by cageface on Thursday February 07, 2013 @09:38PM (#5185987)
I understand the short-term reasoning for choosing Java. Unfortunately mobile is one platform where transparent access to native code is a huge advantage and Java/JNI puts Android at a huge disadvantage here compared to Obj-C/C++.

This is why writing something like a Twitter client is actually much easier in Android but doing something really interesting like realtime multimedia or highly responsive, complex UIs is difficult to the point of impossible in some cases.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by vor_ on Thursday February 07, 2013 @11:25PM (#5186277)
Auto Layout has been a godsend for me. What trouble are you having with it? In particular, I use the 10.8 NSSplitView support to manage resizing behavior without any code.
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by cageface on Thursday February 07, 2013 @11:36PM (#5186311)
For simple things it's fine but it's a real nuisance to work with in IB or in code and complex layouts get out of hand very quickly. The shorthand layout language is cryptic enough to impress a Perl programmer.

I think Android and WP's XML-based structural layouts are far, far easier to work with, understand, modularize, and reuse.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by ridiculous_fish on Friday February 08, 2013 @02:54AM (#5186799)
I don't know much about Android's layout, but from what I have seen, it looks rather ad-hoc. For example, LinearLayout (http://developer.android.com/reference/android/widget/Linear...) looks to be a core layout class. It has boolean properties like "baselineAligned" and "measureWithLargestChild;" these appear to have been added as needs arose, instead of being part of a general layout theory.

Autolayout, on the other hand, has a more general approach of establishing relationships between properties of views. Baseline alignment then just falls out: make view1.baseline = view2.baseline, or view1.top = view2.top for top alignment if you prefer. Equal widths fall out too: view1.width = view2.width. If you want a vertical stack you can write view1.bottom = view2.top. If you want a fixed aspect ratio (say, 4/3), you can write view1.width = view1.height * 4/3.

The result is that it's possible to directly express complex layout ideas. For example, "make three buttons baseline aligned, 10 pixels apart, all of them equal width, none of them clipping their labels. If they cannot fit, then in turn: shrink the padding down to 4 pixels, don't require them to be equal width, truncate the first button's label, or lastly then grow the window / make the view scrollable, until they fit."

That's an unrealistically elaborate example, but with autolayout it can be done entirely in IB, without any code at all. I am guessing with Android it would take a fair amount of manual work.

So my view from a distance is that the autolayout approach is more general and elegant, while the Android approach may handle simple cases easily, but is more ad-hoc and random.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by cageface on Friday February 08, 2013 @04:20AM (#5187011)
You should try actually building some complex Android UIs. You might find it eye-opening after working with iOS for a long time. I certainly did.

It's true that AutoLayout's systems of interdependent linear equations are strictly more powerful than Android's structural layouts but they're a far more awkward solution to the vast majority of common UI layout problems. In practice Android UIs are far, far easier to write and maintain. Debugging the kind of complex AutoLayout schemes you describe can quickly become a nightmare. The structural approach taken by Android and WP is far more natural for the kinds of UIs you actually find in the field.

Also, Android's CSS-like style system makes it far easier to define app-wide constants like grid spacing, margins, button padding etc and to change them in one place.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by vor_ on Friday February 08, 2013 @11:24AM (#5188580)
I haven't developed for Android, but I do know that the interfaces for several major apps I saw were hilariously bad on large screens--literally just the small-screen phone interfaces floating in empty space.

For example, Skype: http://i.imgur.com/4XwVmjy.jpg

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by bookwormAT on Friday February 08, 2013 @01:52PM (#5189457)
That screenshot is Skype from 2011. This is how the app looks today: http://phandroid.s3.amazonaws.com/wp-content/uploads/2012/11...

Responsive design is one of Android's most fundamental design principles. It just took a while (and a few million tablet sales) for developers to take the platform seriously.

Most new android apps are responsive these days. And those companies that maintain their existing apps are busy adding big screen support.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by vor_ on Friday February 08, 2013 @05:36PM (#5190535)
The Skype screenshot is from last year. It was't the only one; another was the Netflix app, and Facebook was really bad: http://i.imgur.com/fSQYQex.png

I'm glad to hear that companies are busy adding big screen support, though that support is arguably coming late. The main point is that an Android app's interface could be stretched across anything, and this has certainly been a design obstacle in the past.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by cageface on Saturday February 09, 2013 @02:42AM (#5192027)
It's not an obstacle it's just laziness. Unlike the iPad you basically get a usable tablet UI for free with Android. Android's fragment API makes it a lot easier than he iPad to adapt to a proper tablet UI if you want.
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by vor_ on Saturday February 09, 2013 @10:50AM (#5192811)
> Unlike the iPad you basically get a usable tablet UI for free with Android.

I just posted two screenshots showing otherwise.

> Android's fragment API makes it a lot easier than he iPad to adapt to a proper tablet UI if you want.

And this is just ridiculous. Regardless of whether you prefer iPads or Androids, iPads are most decidedly easier to design tablet UIs for because there are so few screen sizes.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by cageface on Saturday February 09, 2013 @12:58PM (#5193261)
Usable is the operative word here.

I've built complex tablet apps with both SDKs. Have you?

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by gfodor on Thursday February 07, 2013 @08:38PM (#5185763)
wow. thanks for writing that up. if it's any consolation, you likely just saved me untold amounts of pain as i am wrangling with what approach to take for saving a small but not trivial amount of structured data in my app. this pretty much rules out core data!
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by vor_ on Thursday February 07, 2013 @11:29PM (#5186287)
Don't rule out Core Data! It's very nice (especially with the new concurrency APIs); it hasn't yet been brought totally up to speed with iCloud, but it's been improving every year. Remember that OS X is on annual releases now, so there will be more improvements this year and so on.
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by barumrho on Thursday February 07, 2013 @09:43PM (#5186002)
I wouldn't rule out core data just from this post. Core data may have some quirks, but it's pretty reliable and very useful from my experience. I haven't given iCloud + core data a try, since I wasn't sure if it were reliable yet.
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by interpol_p on Thursday February 07, 2013 @10:12PM (#5186086)
We use Core Data all the time. In over 20 apps or so. We have no problems at all. It's a fantastic persistent storage API with some great features.

That said, I would not use it in conjunction with iCloud. That's where all the trouble is.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by j_s on Thursday February 07, 2013 @09:04PM (#5185865)
Thanks for the details - you have taken this blog post to best-of-HN level!
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by hayksaakian on Thursday February 07, 2013 @07:41PM (#5185542)
that's worse than I could have imagined
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by asveikau on Thursday February 07, 2013 @08:51PM (#5185807)
I've not used the APIs in question, but I'm not sure how this can be totally unexpected, given the marketing promises and the actual technical goals. I read your comment as: "Transparent distributed storage? What could possibly go wrong!"
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by damncabbage on Thursday February 07, 2013 @09:04PM (#5185866)
Wisty said it best in another post: "All sync is horrible. iCould unnecessarily so."

(http://news.ycombinator.com/item?id=5185428)

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by hayksaakian on Thursday February 07, 2013 @09:30PM (#5185960)
My main problem was that it only stored deltas, and thus you could not revert to any specific state if any of the intermediate deltas were lost.

Compare this to something like google docs, which has ways of handling reverts and simultaneous editing.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by anoncow on Thursday February 07, 2013 @11:04PM (#5186229)
would git like architecture been any good for this?
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by taligent on Thursday February 07, 2013 @09:07PM (#5185875)
I would definitely make sure to add some of these to Radar:

http://bugreporter.apple.com

Given how much work they spent trying to reinvent iCloud you would think they would have made it more seamless for developers. Apple really needs to take some of the open source CoreData wrappers (which make life so much easier) and add them to the framework.

The biggest joke is that WebObjects EOF on which CoreData is based used to be really simple. Not sure what happened.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by victorh on Thursday February 07, 2013 @09:23PM (#5185936)
As if Apple reads those. Apple doesn't care about developers, they only care about their real customers; people that don't know how a computer works. I know this because I am a developer and Xcode still uses all the memory and creates a zombie process everytime I run on the simulator.
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by vor_ on Thursday February 07, 2013 @11:33PM (#5186298)
It's clear that Apple engineers do read those bug reports. Any amount of time spent interacting with them publicly will have them directing people to the bug reporter quite often. Their development process appears to be very data-driven; even redundant bug reports that get closed as duplicates are factored into determining bug priority.
Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by taligent on Thursday February 07, 2013 @10:44PM (#5186178)
That site enters directly into Radar the internal bug tracking system where ALL bugs are triaged. It is very much used.

And I my suggestion for your issue (which I have seen in the past but definitely isn't consistent) is to try restarting Xcode and getting rid of preferences.

Re:Why all my iOS Apps are on hold - or iCloud sucks Part II by stevenp on Thursday February 07, 2013 @06:50PM (#5185296)
Agreed. This article is completely useless.