我目前正在使用Xcode 6(测试版6)测试我的应用。UIActivityViewController可以在iPhone设备和模拟器上正常运行,但在iPad模拟器和设备(iOS 8)上崩溃并显示以下日志
Terminating app due to uncaught exception 'NSGenericException',
reason: 'UIPopoverPresentationController
(<_UIAlertControllerActionSheetRegularPresentationController: 0x7fc7a874bd90>)
should have a non-nil sourceView or barButtonItem set before the presentation occurs.
我正在将以下代码用于iOS 7和iOS 8的iPhone和iPad
NSData *myData = [NSData dataWithContentsOfFile:_filename];
NSArray *activityItems = [NSArray arrayWithObjects:myData, nil];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:nil applicationActivities:nil];
activityViewController.excludedActivityTypes = @[UIActivityTypeCopyToPasteboard];
[self presentViewController:activityViewController animated:YES completion:nil];
我的另一个应用程序也发生了类似的崩溃。你能指导我吗?iOS 8中的UIActivityViewController有什么变化吗?我检查了一下,但没有找到任何东西