ios - When I use Post Notification then cancel button of Social framework don't hide Controller but hides alert -


i using social framework sharing purposes.in ibaction of share button post notification.but when press cancel button of alert of settings of particular social networking site alert hides keyboard , controller dont hide. using following code

- (ibaction)shareonfb:(id)sender {     [[nsnotificationcenter defaultcenter]postnotificationname:@"hidenotification" object:nil];     slcomposeviewcontroller *controllerslc = [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypefacebook];      [controllerslc setinitialtext:_dictshare[@"description"]];     [controllerslc addurl:[nsurl urlwithstring:@"http://www.appcoda.com"]];     //    [controllerslc addimage:[uiimage imagenamed:@"test.jpg"]];     [self presentviewcontroller:controllerslc animated:yes completion:nil];  } 

thanks in advance.

i solved myself.you have set completion using following code.

just add following code after presenting controller

[controllerslc setcompletionhandler:^  (slcomposeviewcontrollerresult result) {       [[nsnotificationcenter defaultcenter]postnotificationname:@"hidenotification" object:nil];       nsstring *output = [[nsstring alloc] init];        switch (result) {          case slcomposeviewcontrollerresultcancelled:              output = @"post cancelled";              break;          case slcomposeviewcontrollerresultdone:              output = @"posted successfully";              break;           default:              break;      }  }]; 

Comments