title: Unable to enumerate groups/results while using ALAssetsLibrary in static library
body: <p><em>This question is kind of solved, but one more request remaining at the bottom of this question. And I will choose an answer after all.</em></p>
  <hr />
  <p>I am creating a static library that is using <code>AssetsLibrary framework</code>. While I am using it in a project to test whether is work. It return nothing while I call the <code>enumerateGroupsWithTypes:usingBlock:failureBlock:</code> method of the instance of <code>AssetsLibrary</code>.</p>
  <p>I have trying -</p>
  <ol>
  <li><p>to set breakpoints to see how it running this method. Turns out it did not go into the block that passing to <code>usingBlock:</code>, which is <code>ALAssetsLibraryGroupsEnumerationResultsBlock</code>, and either the <code>failureBlock:</code>. So that I got nothing.</p>
  </li>
  <li><p>to add the same enumerating code to the project I mentioned at the beginning to try to calling method of <code>AssetsLibrary</code>. it worked perfectly <strong>fine</strong>.</p>
  </li>
  <li><p>to test whether it is block by the main thread, then run it in the main thread. Got the same result as before.</p>
  </li>
  </ol>
  <p>For this issue, I have found an answer of other question that is talking about using media in the static library: <a href="https://stackoverflow.com/a/15331319/1583560">https://stackoverflow.com/a/15331319/1583560</a>, and I am not sure I have run into the same situation, is the media he/she mentions including accessing <code>AssetsLibrary</code>, I guess no here.</p>
  <p>Hope someone can point some directions of this, thank you :)</p>
  <hr />
  <h3>Update</h3>
  <p>This is the code I used -</p>
  <pre><code>[[[ALAssetsLibrary alloc] init] enumerateGroupsWithTypes:ALAssetsGroupAll
                                                usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
                                                    NSLog(@&quot;%s&quot;,__PRETTY_FUNCTION__);
                                                } failureBlock:^(NSError *error) {
                                                    NSLog(@&quot;%s&quot;,__PRETTY_FUNCTION__);
                                                }];
  </code></pre>
  <p>Code in the static library is the same as in the test project, the only difference is I make a model class to access <code>AssetsLibrary</code> in the static library.</p>
  <p>To be clear, here are few changes I have made in the static library -</p>
  <ul>
  <li>Change <code>Build Product Path</code> in <em>Target &gt; Build Settings</em> to <code>$(PROJECT_DIR)/../build</code></li>
  <li>Moving required header file to Project section in <em>Target &gt; Build Phases &gt; Copy Headers</em></li>
  <li>Set <code>Skip Install</code> to <code>YES</code> in <em>Target &gt; Build Settings</em></li>
  </ul>
  <p>Environment related -</p>
  <ul>
  <li>OS X 10.9.1</li>
  <li>Xcode 5.0.2</li>
  <li>Standard architectures (including 64-bit)  <em>(both static library and the project)</em></li>
  <li>ARC</li>
  </ul>
  <hr />
  <h3>More details</h3>
  <p>Here is my propose to make a assets model for easy accessing in this static library.</p>
  <ul>
  <li>Having a group array to store all the albums, which is <code>ALAssetsGroup</code> here, in devices.</li>
  <li>Enumerating <em>albums</em> out at the <code>init</code> of this model and storing into the group array.</li>
  <li>Enumerating <em>photos</em>, which is <code>ALAssets</code> result, by the group given while needed.</li>
  </ul>
  <p>And this model using singleton pattern.</p>
  <p><em>BTW</em>, I have tried to observe the <code>ALAssetsLibraryChangedNotification</code> in this static library. It's not working, too. <strike>Are there any potential obstructs at the front of <code>AssetsLibrary</code>?</strike></p>
  <hr />
  <h3>Update</h3>
  <p>I have find out that I enumerate the groups while <code>init</code> the model I created. And there are threads make blocks not work. If I trigger the enumerate after the <code>init</code> complete, will work perfectly. And I also found the way to know when it is done enumerating (cf. <a href="https://stackoverflow.com/a/13309871/1583560">https://stackoverflow.com/a/13309871/1583560</a>) to get the group array which I stored.</p>
  <p><em><strong>Further</strong></em>, I still cannot find the document, Apple's, that addressing the threading of block, why it will not been call while <code>init</code>, yet. If someone could point out for me, I will appreciate it :).</p>