Question

For some users of my application, whenever I attempt to display a UIActivityViewController for sharing data, the presented activity view disappears immediately, but does not dismiss (which leads to me not being able to present a new one).

For whatever reason, this is only happening for some users, and for those users it happens every time. I haven't been able to discern a pattern in terms of device type, etc. I hooked up one of the user's phones and watched the console log, and I saw this error go by every time the UIActivityViewController disappeared:

Apr 16 10:00:28 Test-iPhone wirelessproxd[4635] <Notice>: (Error) error event: (<OS_xpc_error: <error: 0x192556dc8> { count = 1, contents =
    "XPCErrorDescription" => <string: 0x1925570d0> { length = 18, contents = "Connection invalid" }
}>)

I can't seem to find any relevant results for that error online anywhere. What's causing this issue?

Here's the code where I'm creating the UIActivityViewController:

UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[self.currentStory, self.currentStory.webURL] applicationActivities:(USES_IPAD_UI? @[saveStoryActivity] : nil)];
BOOL blockPaused = self.userPaused;
activityViewController.completionHandler = ^(NSString *activityType, BOOL completed) {
    if (!blockPaused)
        [playerViewController play];
};

if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
    [self.navigationController presentViewController:activityViewController animated:YES completion:NULL];
} else if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
    if (!self.activityPopover) {
        self.activityPopover = [[UIPopoverController alloc] initWithContentViewController:activityViewController];
    } else {
        self.activityPopover.contentViewController = activityViewController;
    }

    [self.activityPopover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}

So far, I've only seen this happen on iPhone, but I included the iPad code as well, just in case.

Was it helpful?

Solution

Gah. Turns out this was caused by a bit of code we had in there only for beta users which displayed the build number in a CALayer that floated above everything else (layer.zPosition = CGFLOAT_MAX). UIActivityViewController appears to not like being below anything else. Commented out that beta code, everything works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top