<story><title>Facebook iOS SDK Remotely Crashing Spotify, TikTok, Pinterest, Winno and More</title><url>https://github.com/facebook/facebook-ios-sdk/issues/1374</url></story><parent_chain><item><author>saagarjha</author><text>(For the iOS engineers reading along: please don&amp;#x27;t put network calls in +load, or __attribute__((constructor)), or a C++ static variable, or whatever other clever way you think you can get code execution before main.)</text></item><item><author>fooey</author><text>Seems to be some suggestions now that apps were continuing to crash even after commenting out the FB implementation because FB is managing to do remote API calls just because the framework is linked.&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;facebook&amp;#x2F;facebook-ios-sdk&amp;#x2F;issues&amp;#x2F;1373#issuecomment-624944045&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;facebook&amp;#x2F;facebook-ios-sdk&amp;#x2F;issues&amp;#x2F;1373#iss...&lt;/a&gt;&lt;p&gt;&amp;gt; It does not matter. Their libraries are dynamic, and they abuse +load functions for classes with some business logic calls. So, +load will be called anyway on the application launch when dyld loads all linked frameworks.&lt;p&gt;and&lt;p&gt;&amp;gt; I really don&amp;#x27;t understand why it is still crashing when we turn it off? Could you please explain, why there is a remote connection even we comment out the implementation? Linking binary framework just enough to break things down, why? What do you do in background? Sending or receiving some data even it&amp;#x27;s not been initialized?</text></item></parent_chain><comment><author>red_admiral</author><text>For the iOS developers reading along: please ban this behaviour in a future version?</text></comment>
<story><title>Facebook iOS SDK Remotely Crashing Spotify, TikTok, Pinterest, Winno and More</title><url>https://github.com/facebook/facebook-ios-sdk/issues/1374</url></story><parent_chain><item><author>saagarjha</author><text>(For the iOS engineers reading along: please don&amp;#x27;t put network calls in +load, or __attribute__((constructor)), or a C++ static variable, or whatever other clever way you think you can get code execution before main.)</text></item><item><author>fooey</author><text>Seems to be some suggestions now that apps were continuing to crash even after commenting out the FB implementation because FB is managing to do remote API calls just because the framework is linked.&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;facebook&amp;#x2F;facebook-ios-sdk&amp;#x2F;issues&amp;#x2F;1373#issuecomment-624944045&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;facebook&amp;#x2F;facebook-ios-sdk&amp;#x2F;issues&amp;#x2F;1373#iss...&lt;/a&gt;&lt;p&gt;&amp;gt; It does not matter. Their libraries are dynamic, and they abuse +load functions for classes with some business logic calls. So, +load will be called anyway on the application launch when dyld loads all linked frameworks.&lt;p&gt;and&lt;p&gt;&amp;gt; I really don&amp;#x27;t understand why it is still crashing when we turn it off? Could you please explain, why there is a remote connection even we comment out the implementation? Linking binary framework just enough to break things down, why? What do you do in background? Sending or receiving some data even it&amp;#x27;s not been initialized?</text></item></parent_chain><comment><author>kccqzy</author><text>Not just network calls, but also the file system, or basically anything nontrivial.&lt;p&gt;C++ static variables can now be annotated with constinit to resolve issues like this: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;en.cppreference.com&amp;#x2F;w&amp;#x2F;cpp&amp;#x2F;language&amp;#x2F;constinit&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;en.cppreference.com&amp;#x2F;w&amp;#x2F;cpp&amp;#x2F;language&amp;#x2F;constinit&lt;/a&gt; It basically asks the compiler to enforce that constructor calls can only do trivial things.</text></comment>