iphone - Show UIAlertView during UIActivity:activityViewController -


i have set of uiactivities prepare data given format , attach email user can send. i'm using subclass of uiactivity , i'm doing work in -(void)activityviewcontroller:

- (uiviewcontroller *)activityviewcontroller {     [self.alert show];      nsstring *filename = [nsstring stringwithformat:@"%@.gpx", self.activity.title];     __block mfmailcomposeviewcontroller *mailcomposevc = [[mfmailcomposeviewcontroller alloc] init];     mailcomposevc.mailcomposedelegate = self;     [mailcomposevc setsubject:[nsstring stringwithformat:@"gpx export %@ activity", self.activity.title]];     [mailcomposevc setmessagebody:@"generated slopes" ishtml:no];      dispatch_sync(dispatch_get_global_queue(dispatch_queue_priority_low, 0), ^{         cbcfileexporter *exporter = [[cbcfileexporter alloc] init];         nsdata *exportcontents = [exporter exportactivity:self.activity infileformat:cbcfileexporttypegpx error:nil];         [mailcomposevc addattachmentdata:exportcontents mimetype:@"application/gpx+xml" filename:filename];     });      [self.alert dismisswithclickedbuttonindex:0 animated:yes];      return mailcomposevc; } 

the specific issue i'm running uialertview doesn't show until dispatch_sync completes. realize dispatch_sync might(?) blocking main thread waits, problem need wait until attachment generated before returning method call (mfmailcomposeviewcontroller docs can't add attachment once view presented).

how can alertview show while non-trivial task main thread has wait completion has run?

given mail view controller disallows adding attachment mail compose view controller once has been presented, need here create , present "interstitial" view controller indeterminate progress indicator, start export process in background, , when process complete, create , populate mail compose view controller attachment, present it.

that requirement populated before being presented means there won't simple "do in background , call me back" approach possible.


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 -