ios - Xcode IOS7 ALAssetsLibrary Code not executed -


i using alassetslibrary save images download online server. each image imageobject image details. save photo album (to save , retrieve url , url converted uuid of image). once uuid added imageobject, imageobject added realm database.

the problem code save photo album not executed. ignored. hope question clear, should make code (block) executable?

[self writeimagessuccessively:[[nsmutablearray alloc] initwitharray:temposarray] completion:^(id result) {     nsstring *res = (nsstring *)result;     if ([res isequaltostring:@"finished"]) {         //add realm     } else {         nslog(@"unable finish writing images");     } }]; 

the above code call method call addimagetoassetlibrary save photos album , return unique uuid each individual image.

- (void) writeimagessuccessively:(nsmutablearray*)imgarr completion:(void(^)(id result))completionhandler { if ([imgarr count] == 0) {     if (completionhandler) {         // signal completion of writing images in imgarr         completionhandler(@"finished");     }     return; }  imageobject* imgobj = [imgarr firstobject]; [imgarr removeobjectatindex:0]; __block __typeof__(self) _self = self;  [self addimagetoassetlibrary:imgobj completion:^(bool success, nsstring *response) {     if (success) {         imgobj.imagename = response;         nslog(@"***saved image: %@, %@, %lu", imgobj.imagename, response, (unsigned long)[imgarr count]);     } else {         nslog(@"could not save %@", imgobj.imagename);     }     [_self writeimagessuccessively:imgarr completion:completionhandler]; }]; 

}

this method add imageobject imgobj array photo album , return uuid. however, // 1) create album [self.library addassetsgroupalbumwithname:albumname resultblock:^(alassetsgroup *group) { nslog(@"added album:%@", albumname); } not being executed.

- (void) addimagetoassetlibrary:(imageobject *)imgobj completion:(void(^) (bool success,      nsstring* response))completion { nsdata *imgdata = uiimagejpegrepresentation(imgobj.image, 0.5);  nsstring *albumname = @"algoaccess photo album";  // __block? // distinct storage type, modifications var done inside block visible outside of __block __typeof__(self) _self = self; __block alassetsgroup* grouptoaddto; __block alassetslibrary* library;  // 1) create album **not executed [self.library addassetsgroupalbumwithname:albumname resultblock:^(alassetsgroup *group) {     nslog(@"added album:%@", albumname);   } } //**next line of execution here 

edit: 1 suspect, block not being called , other block being called instead. any1 can suggest how go debugging such causes?


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -