ios - Can't change property of self in asynchronous block -


i'm trying change properties of self, can't change in asynchronous block. here code:

__weak typeof(self) weakself = self;  nsurlsessiondatatask *posttask = [session datataskwithrequest:request completionhandler:^(nsdata *data, nsurlresponse *response, nserror *error) {     if (response == nil)     {         //     }     else     {         // else          dispatch_async(dispatch_get_main_queue(), ^{             nsstring *markername = [nsstring stringwithformat:@"public-%@",[weakself.pad getmarkernameforcategory:weakself.categorylabel.text]];             weakself.pad.markername = markername;              [weakself.navigationcontroller popviewcontrolleranimated:yes];         });     } }];       [posttask resume]; } 

if i'm setting breakpoint after assignment weakself.pad.markername = markername markername not being set, still old value.

some project details: ios 7, arc enabled

edit

changed first line __block typeof(self) weakself = self; problem still exists.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -