Hacker News new | ask | show | jobs
by drewcrawford 4592 days ago
> everyone knows __block semantics changed

Everyone except the authors of the "Blocks Programming Topics" and the authors of the AVCamCaptureManager sample code. Maybe.

FYI the reason I included the digression about the __block change specifically is that I was recently fixing bugs on a project that uses AVCamCaptureManager, and Apple's mis-use of __block in that class, this is not a joke, through a series of corner cases, caused the status bar to unexpectedly and nondeterminisitically change color about 5% of the time on an unrelated screen.

Saying "everybody should already know how to do weak references" is great in theory. But if you are fielding weird reports for unreproducible status bar issues and it occurs to you at any time in the first hour that maybe Jim from the next cubicle used buggy sample code for a video recording feature on another screen you are a WAY better software developer than I am.

Of course this is standard stuff. But unlike a lot of standard stuff, this one can go undetected for long periods, and crop up in very unexpected places. That's the problem.

2 comments

Apple's sample code is terrible. I've always assumed it is written by interns because it is generally bug ridden and often not the right way to do something.
Do you mean the code examples in articles or the projects that you can download? Because I haven't looked at their downloadable samples in quite some time, but their docs always seem alright to me.
Both, in my experience. The downloadable code is usually a rush job and has all sorts of sloppiness and missed edge cases. The code in the docs is usually cleaner (because it's just excerpts), but doesn't always get updated when APIs change.
The code samples are just bad and many are very outdated. I generally just read the header comments now and hit SO if I need more.
> Everyone except the authors of the "Blocks Programming Topics" and the authors of the AVCamCaptureManager sample code. Maybe.

No - it's just that these documents/samples haven't been updated when they should have been. Have you filed a Radar?

> have you filed a radar

I have radars open on both of these issues (and a large quantity of other things referenced in this post). They remain open for long periods of time without acknowledgment, as is tradition.