ios - Upload UIImage in dispatch_async -


i have problem. call method in dispatch_async. in callmethod2 in different object uploading image [nsurlconnection sendasynchronousrequest. after upload, doesn't show me response. (however when call callmethod2 without dispatch_async, works great). can problem?

dispatch_async(dispatch_get_global_queue( dispatch_queue_priority_default, 0), ^(void){     [offline callmethod1];     [offline callmethod2]; }); 

upload image

[nsurlconnection sendasynchronousrequest:request queue:[nsoperationqueue currentqueue] completionhandler:^(nsurlresponse *response, nsdata *data, nserror *error) {      nslog("never show me me log");  }]; 

you're calling nslog on thread isn't main thread (aka calling asynchronously) won't see nslog must run on main thread.

you can have completion block notify other way when it's done. best way i've found using https://github.com/kseebaldt/deferred allows send promise saying (i promise i'll thing , notify when it's done).


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -