In Objective-C, what is called before main?

In Objective-C, what is called before main? For example, I assume that all metaclasses in Objective-C receive an instance in front of main and the load / initialization methods they call, global constants, etc. What else? Is it documented anywhere?

+4
source share
1 answer

A +loadmethod that is part of any class in your application (not in any loaded structure) will be executed before main(). The full order of execution is given in the documentation +load( NSObject):

load , , , .

:

• , .

+load .

• ++ C/++ __attribute__(constructor) .

• , .

:

+load +load.

+load +load .

, , , , .

, +load, , , main().

+2

Source: https://habr.com/ru/post/1542875/


All Articles