19
UIActivityViewController在iOS 8 iPad上崩溃
我目前正在使用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]; …