title: Download and execute iOS code dynamically at runtime
body: <p>As an academic and mental exercise, how would one download a precompiled binary file and execute methods in it on an iOS device? </p>
  
  <p>I understand this violates Apple's License Agreement, section 3.2.2, but I am asking for personal projects and to learn more about the iOS runtime. </p>
  
  <p><strong>Goal</strong></p>
  
  <ul>
  <li>Download <a href="http://someexample.com/MyCoolBinary.a" rel="nofollow">http://someexample.com/MyCoolBinary.a</a></li>
  <li>Save downloaded binary to device disk. </li>
  <li>Call a known method that exists in the binary.</li>
  </ul>
  
  <p><strong>What I've tried</strong></p>
  
  <p>I haven't attempted anything concrete, but I would imagine that it would be possible to do something along the lines of...</p>
  
  <pre><code>void *myDownloadedLibrary = dlopen("/path/to/newly/downloaded/framework/MyCoolBinary.framework")
  dlsym(myDownloadedLibrary)
  </code></pre>
  
  <p>Any examples or pointers on what kind of libraries this would work with would be appreciated.<br>
  Thanks.</p>