Mark Ingram Mark Ingram - 1 year ago 91
iOS Question

Can you access the mainBundle from the non-UI thread?

I have some code which statically accesses

[NSBundle mainBundle]
, but the documentation doesn't make clear whether this can be accessed from a non-UI thread. I know all UI operations must be executed on the UI thread, but is the
classed as a UI element?

Answer Source

The class prefix begins with NS* not UI* so no, the mainBundle isn't part of the UI subsystem and you can access it from a background thread.

It's worth remembering that the contents of the mainBundle on iOS are immutable... so you are only really going to get useful info by reading from mainBundle not writing.