Ilya Kulakov (tweet):
While possibility of race conditions in the multithreaded code is a side effect of the desired behavior when multiple processing units compute result based on the shared data, Same-Stack Race Conditions are outright incorrect.
KVO, while often a hated victim, is not the only troubled technology. Everything that uses same-stack callbacks, including Delegates and Notifications, is susceptible.
[…]
In Objective-C and Cocoa I use the following lock-like approach that relies on RAII scopes (and relatively “modern” Clang and GCC that support the cleanup
attribute) to detect the errors[…]
Previously:
Cocoa iOS iOS 13 Key-Value Observing (KVO) Mac macOS 10.15 Catalina Objective-C Open Source Programming
Brent Simmons (tweet):
But in NetNewsWire for iOS (currently in beta) this sometimes doesn’t work because, for some people, the system won’t let you select an OPML file to import. (This does not happen on Macs.)
[…]
We found that if a user has another app that declares an OPML UTI — and that UTI doesn’t match ours — then the document picker will not see those OPML files as the type we accept (org.opml.opml
) but as something else.
The workaround is to let the user select any text file, which is not great.
Guy English:
Remember when Apple maintained a register for type/creator codes. This was supposed to get away from that and yet... It does seem like some simple web registry system (optional) would help developers who want to do the right thing (the vast majority) be able to do so more easily.
Jake Carter:
That was a fun one I hit when working on OmniOutliner. After hitting other issues I believe we settled on declaring ourselves as able to read ALL file types and just screen them at the time we try to open them. Not great, but it worked.
Kyle Howells:
I ran into the exact same problem the very first time I tried to use the iOS file pocket APIs.
Apple doesn’t like how messy and imprecise file extensions are so they don’t let iOS apps use them.
Instead you have to use a much more complex API involving UTI definitions.
Except iOS doesn’t handle conflicts well, making the entire thing useless.
I ended up giving up asking for ‘public.data’ (everything) and then just filtering the selected file name in app.
That was the only way I could guarantee the user would actually be able to use my app without another apps UTI definition breaking my app completely.
Especially as iOS is designed that the system knows best and doesn’t allow the user any sort of override or control.
iOS doesn’t have an option to allow the user to even see the file extensions, let alone change them.
Peter Steinberger:
We‘re running into a similar problem where apps override the public PDF. Been hunting them down and explaining them the error one by one, but it‘s like Don Quijote.
Curtis Herbert:
This has been a blight in the GPS world for apps that import GPX files. Apple’s suggestion in the dev forums was ... less than practical.
Annoyingly, this wasn’t a problem until iOS 13. It’s really annoying that Apple opted for the “technically correct” way that lets one rogue app break the user experience.
Douglas Hill:
It looks like UIKit’s document picker and browser use UTTypeCreatePreferredIdentifierForTag
. It’s behaviour is documented as being undefined, so some random type wins.
Audit your code! Use UTTypeCreateAllIdentifiersForTag
instead to handle all possibilities.
Update (2020-02-14): Adam Maxwell:
This has been a problem on the Mac for years. I even wrote a whitepaper about it, trying to get Mac TeX developers to coordinate our own set of common UTIs.
Jonathan Grynspan:
Re the “UTI bug”: if people are still seeing issues in the latest seeds, please file bugs so the right folks know what’s not working.
Bug iOS iOS 13 NetNewsWire OPML PDF Uniform Type Identifier