iOS: HowTo send SIGNAL when Controller ends preview
- 
For my Sharing Example App I have to send a SIGNAL when UIDocumentInteractionController ends preview. void MyShare::sendFile(...) { static DocViewController* docViewController = nil; ... docViewController = [[DocViewController alloc] init]; [qtUIViewController addChildViewController:docViewController]; documentInteractionController.delegate = docViewController; [documentInteractionController presentPreviewAnimated:YES]; ... } // TODO: HowTo call this method from docViewController ? void MyShare::handleDocumentPreviewDone() { // send the SIGNAL emit shareFinished(); }#import "DocViewController.h" @interface DocViewController () @end @implementation DocViewController #pragma mark - #pragma mark View Life Cycle - (void)viewDidLoad { [super viewDidLoad]; } #pragma mark - #pragma mark Document Interaction Controller Delegate Methods - (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller { #pragma unused (controller) return self; } - (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller { #pragma unused (controller) // TODO HowTo call handleDocumentPreviewDone() from MyShare ?? [self removeFromParentViewController]; } @endI have no Obj-C knowledge, it's even hard to 'read' the syntax - that's why I'm not developing native for iOS and using Qt ;-) 
 any ideas what to do ?
 it's the very last step before I'll make my Sharing Example App for Android and iOS public.
 thx
- 
here's the Blog: http://blog.qt.io/blog/2017/12/01/sharing-files-android-ios-qt-app/ 
 thx to all helping me with this
- 
For my Sharing Example App I have to send a SIGNAL when UIDocumentInteractionController ends preview. void MyShare::sendFile(...) { static DocViewController* docViewController = nil; ... docViewController = [[DocViewController alloc] init]; [qtUIViewController addChildViewController:docViewController]; documentInteractionController.delegate = docViewController; [documentInteractionController presentPreviewAnimated:YES]; ... } // TODO: HowTo call this method from docViewController ? void MyShare::handleDocumentPreviewDone() { // send the SIGNAL emit shareFinished(); }#import "DocViewController.h" @interface DocViewController () @end @implementation DocViewController #pragma mark - #pragma mark View Life Cycle - (void)viewDidLoad { [super viewDidLoad]; } #pragma mark - #pragma mark Document Interaction Controller Delegate Methods - (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller { #pragma unused (controller) return self; } - (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller { #pragma unused (controller) // TODO HowTo call handleDocumentPreviewDone() from MyShare ?? [self removeFromParentViewController]; } @endI have no Obj-C knowledge, it's even hard to 'read' the syntax - that's why I'm not developing native for iOS and using Qt ;-) 
 any ideas what to do ?
 it's the very last step before I'll make my Sharing Example App for Android and iOS public.
 thxis there anybody out there ... 
 ... with some Obj-C knowledge ?thx 
- 
is there anybody out there ... 
 ... with some Obj-C knowledge ?thx @ekkescorner did you ask on QtMob yet? (https://qtmob.slack.com/ for those who don't know the place) 
- 
@ekkescorner did you ask on QtMob yet? (https://qtmob.slack.com/ for those who don't know the place) @tekojo yes, I already asked there some days ago. 
 will try Interests list and StackOverFlow
- 
Hi, Add a custom init function to DocViewControllerwhich takes a MyShare object as parameter (e.g. initWithMyShare) then pass it the instance of your object and store it as a local variable. Then just call the method on the object indocumentInteractionControllerDidEndPreview.You can see an implementation example for the iOS clipboard support class. Hope it helps 
- 
Hi, Add a custom init function to DocViewControllerwhich takes a MyShare object as parameter (e.g. initWithMyShare) then pass it the instance of your object and store it as a local variable. Then just call the method on the object indocumentInteractionControllerDidEndPreview.You can see an implementation example for the iOS clipboard support class. Hope it helps @SGaist thx. will try to figure out the correct syntax ;-) 
- 
Hi, Add a custom init function to DocViewControllerwhich takes a MyShare object as parameter (e.g. initWithMyShare) then pass it the instance of your object and store it as a local variable. Then just call the method on the object indocumentInteractionControllerDidEndPreview.You can see an implementation example for the iOS clipboard support class. Hope it helps @SGaist thx to your hints I found a way to make it work. 
 I'm writing a blog about the App and perhaps someone can take a look at the code if it's ok.
- 
I'd be happy to review it. 
- 
@SGaist cool. will let you know when it's public. probably tomorrow. 
 this was the last open topic on iOS.
 I must know when preview was done, because if sharing a File from App Data Location, the File must be copied to Documents Location to be available for UIDocumentInteractionController. Then when user comes back to the App I must delete the File from Documents location.
- 
Might be a job for QTemporaryFile ? 
- 
Might be a job for QTemporaryFile ? @SGaist I need the origin filename, so I don't think so. 
 BTW: on iOS I must always delete the file from Documents location,
 on Android if ACTION_VIEW intent I also delete the file,
 but if ACTION_EDIT then depending from result code I must move File back into origin AppDataLocation or simply delete if Edit was canceled.
- 
here's the Blog: http://blog.qt.io/blog/2017/12/01/sharing-files-android-ios-qt-app/ 
 thx to all helping me with this
