I recently submited an app and it got rejected due to the isse:
the share button does not function, when a user presses it no action occurs
It was working before I submit it to appstore. But now it's not.
I am unable to present the document interaction controller.
HEre is what I had working before:
UIAlertAction* share = [UIAlertAction
actionWithTitle:@"Share"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[self shareImage];
[alert dismissViewControllerAnimated:YES completion:nil];
}];
After executing this I got the warning:
_bsmacherror (os/kern) invalid capability (20)
_bsmacherror (os/kern) invalid name (15)
then I put the shareImage code on main thread:
dispatch_async(dispatch_get_main_queue(), ^{
[self shareImage];
});
The warning is disappeared......But it still doesnt open the document interac controller
And the code to open doc interac controller is:
-(void)shareImage{
UIButton *button = (UIButton *)nil;
NSURL *URL = [NSURL fileURLWithPath:_savedImagePath];
if (URL) {
// Initialize Document Interaction Controller
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];
// Configure Document Interaction Controller
[self.documentInteractionController setDelegate:self];
// Present Open In Menu
[self.documentInteractionController presentOpenInMenuFromRect:[button frame] inView:self.view animated:YES];
}
}
I set the UIDocumentInteractionControllerDelegate
and I checked that image exists at the _savedImagePath
.
Is there any error handling method for doc interac controller ?
How do I solve the issue ?
Your problem appears to be due to button
being nil
and trying to present the controller from the nil
button's frame. That gives you a frame of CGRectZero
. Why are you doing that?
Show the controller from a valid frame or from a UIBarButtonItem
.