ios - Unable to alter UIButton in EKEvent code -


i'm trying create button when pressed creates calendar event, , changes title of said button "event created" or perhaps creates an alertview same effect. code far:

- (ibaction)addtocal:(id)sender { ekeventstore *store = [[ekeventstore alloc] init];      [store requestaccesstoentitytype:ekentitytypeevent completion:^(bool granted, nserror *error) {     if (!granted) {        //code handle not-granted     }     else {             //code create event                       [event setcalendar:[store defaultcalendarfornewevents]];             nserror *err;             [store saveevent:event span:ekspanthisevent error:&err];             [[nsuserdefaults standarduserdefaults] setbool:true forkey:[nsstring stringwithformat:@"%@sub", prevdest] ];             [[nsuserdefaults standarduserdefaults] synchronize];             [addreminder  settitle: [nsstring stringwithformat:@"subscribed!"] forstate: uicontrolstatenormal];              uialertview *alert = [[uialertview alloc] initwithtitle:@"event added!"                                                             message:@""                                                            delegate:nil                                                   cancelbuttontitle:@"ok"                                                   otherbuttontitles:nil];             [alert show];           }     }];     //where tested different placement of code } 

now creates event fine , dandy, doesn't create alertview or change title confirmation, , more, makes app freeze , become unresponsive touches... until, is, press home button, reopen app, @ point title changes, , alertview pops up.

i've tried putting title changing code @ marked location, makes work, of course outside if(!granted), , therefore cause button change no matter what. , putting code there causes same freezing phenomena.

i have no clue whats this. has on here had same problem?

try:

dispatch_async(dispatch_get_main_queue(), ^{        uialertview *alert = [[uialertview alloc] initwithtitle:@"event added!"                                                         message:@""                                                        delegate:nil                                               cancelbuttontitle:@"ok"                                               otherbuttontitles:nil];        [alert show]; }); 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -