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