TransitApp/SVWebViewController

fix for "share" button on ipad iOS9+

Opened this issue · 0 comments

Crashes on ipad ios9+ if we dont set the UIPopoverPresentationController source

  • (void)actionButtonClicked:(UIBarButtonItem *)sender {
    NSArray *activities = @[[SVWebViewControllerActivitySafari new], [SVWebViewControllerActivityChrome new]];

    UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:@[self.self.webView.request.URL] applicationActivities:activities];
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
    UIPopoverPresentationController *popPresenter = [activityController popoverPresentationController];
    popPresenter.barButtonItem = sender;

    }
    [self presentViewController:activityController animated:YES completion:nil];
    }