objective c - Why does this array not being populated? -
even if assetsenumerator block executed in different thread still takes long time images fill array , that's why i'm trying this, better performance. thing i've begun scratching surface concerning multithreading , have lot of reading do. i've tried solve problem after reading few posts regarding , 1 of them being how store assets asynchronous enumerator in alassetslibrary? , in vain.
void (^assetenumerator)(alasset *, nsuinteger, bool *) = ^(alasset *result, nsuinteger index, bool *stop) { if (result != null) { dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ alassetrepresentation *rep = [result defaultrepresentation]; cgimageref ref = [rep fullscreenimage]; uiimage *image = [uiimage imagewithcgimage:ref]; nslog(@"%@",image); ->>> image exists dispatch_async(dispatch_get_main_queue(), ^ { nslog(@"%@ array",_albumpics); [_albumpics addobject:image]; }); }); } };
i tried obtain images without block classic iteration through assets array... . quick fix real great ! many
2013-04-05 16:31:42.256 photo_share[10276:907] ( ) array
Comments
Post a Comment