3 ms·
Even better: don't override +load or use static constructors!
by favorited 6y ago
Even better: don't override +load or use static constructors!
- saagarjha 6y agoEh, I wouldn't go that far; they do have their uses. But for a SDK author, it pays to be excessively cautious when putting things on the application startup path. (Something which the Facebook is well aware of, as the dyld session is always full of their company's engineers, and the architecture of their app shows that put effort into meeting launch deadlines…)
- favorited 6y agoEvery bad thing has its uses. If an SDK author wants to be a responsible participant in the app's startup path, it will defer its own setup to the app. `__attribute__((constructor))` is most obviously a hack – like any great hack, it is useful enough to be implemented everywhere, but it will never be standardized because everyone acknowledges that it sucks. I used to use it! But it is extremely limited in its usefulness, and there are always better solutions to the problem.