Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6069991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:52:58+00:00 2026-05-23T09:52:58+00:00

So, in init function I am getting images via AssetsLibrary //initWithNibName: photoArray = [[NSMutableArray

  • 0

So, in init function I am getting images via AssetsLibrary

//initWithNibName:

photoArray = [[NSMutableArray alloc ]init];
    ALAssetsLibrary *asset = [[ALAssetsLibrary alloc] init];
    void (^enumerateGroup)(ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop)
    {
        if (result != nil) {
            [photoArray addObject:result];
            NSLog(@"%@", result);
        }

    };
    void (^enumerationBlock)(ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop)
    {
        if (group != nil) {
            [group enumerateAssetsUsingBlock:enumerateGroup];
        }
    };
    [asset enumerateGroupsWithTypes:ALAssetsGroupAll 
                         usingBlock:enumerationBlock 
                       failureBlock:^(NSError *error) {NSLog(@"Something went wrong");}];
    [asset release];

//loadView

- (void)loadView
 {
UIView *view = [[UIView alloc ] init];
NSLog(@"%d", [photoArray count]);
self.view = view;
[view release];
}

Log from console:

2011-06-24 18:55:12.255 xxx[9450:207] 0 //

2011-06-24 18:55:12.306 xxx[9450:207] ALAsset – Type:Photo, URLs:{
“public.jpeg” = “assets-library://asset/asset.JPG?id=1000000001&ext=JPG”;

And I am confused. As you can see in the log, loadView executed code faster than initWithNibName. This is because getting images via AssetLibrary take some time. But I think all of this code is executing in one thread, so loadView should wait, for initWithNibName.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:52:59+00:00Added an answer on May 23, 2026 at 9:52 am

    The documentation for -enumerateGroupsWithTypes:... and -enumerateAssetsUsingBlock:... doesn’t say that those methods execute synchronously. From what you’ve found, it looks like they do their enumeration on a different thread so that you don’t have to wait.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My code is inside a plugin's init function and I'm trying to file_get_contents() on
In the code: slider.init({ foo: bar }); var slider={ init:function(data){ } } If I
How can I add a field in the form init function? e.g. in the
var A=function(){ }; $.extend(A.prototype, { init:function(){ alert('A init'); } }); var B=function(){ }; $.extend(B.prototype,A.prototype,{
public function init(){ $this->view->user = Zend_Auth::getInstance()->getIdentity(); $this->view->siteName = Zend_Registry::get('config')->site->name; $this->view->menu = $this->_helper->generateMenu(Zend_Auth::getInstance()->getIdentity()); $this->view->slogan =
I have a class: function RustEditor() { this.init = function() { var saveButton =
I have got the following very simple code: function init() { var articleTabs =
(function($){ $.fn.slideshow = function(){ function init(obj){ setInterval(startShow(), 3000); } function startShow(){ alert('h'); } return
var mC = function(map){ var init = function(iMap){ alert(Init + this + with); }
how can i call stopEvent within init? testObj.prototype = { init: function(wrapper) { wrapper.onclick

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.