Hacker News new | ask | show | jobs
by enzo1982 2958 days ago
Apple gets a bad reputation for their supposed lack of backwards compatibility. Nothing is further from the truth.

Well, they definitely break a lot of things. Mostly things that were never documented or guaranteed to work, though.

My app [1] regularly broke with new macOS releases between 10.9 and 10.12. So often I actually shivered when they announced a new version.

I was calling Cocoa stuff from separate threads which is almost never guaranteed to work on macOS (the UI is explicitly not thread-safe). It usually worked on older releases though, but since 10.9 or so, it broke a little more with almost every new release.

Not really Apple's fault as it's mosty breaking stuff that was explicitly not guaranteed to work in the first place and which I shouldn't have used. On the other hand, Microsoft seems to keep every quirk from Windows 9x time still working until today.

[1] https://github.com/enzo1982/freac

1 comments

> I was calling Cocoa stuff from separate threads which is almost never guaranteed to work on macOS (the UI is explicitly not thread-safe)

It seems to me that you know what's wrong here, but just in case you don't, most UI work should be done on the main thread. There are certain lower-lever layer APIs that IIRC do explicitly allow for calls from multithreaded contexts, but other than that stick to the main thread. There's actually a new tool, the thread sanitizer, that helps you adhere to this by flagging all misuse of Cocoa outside the main thread.

This is the case for almost every graphical toolkit I’ve developed for.