ios swift crash uipopovercontroller

ios - bloqueo al mostrar UIPopOverPresentationController



swift crash (2)

*** Aplicación de finalización debido a excepción no detectada ''NSGenericException'', razón por la cual: ''UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x1a56bd90>) debe tener un conjunto de fuentes no fuente o barButtonItem antes de que ocurra la presentación.''


Modifiqué con el código a continuación y encontré la solución.

if (DeviceType.IS_IPAD == false) { presentViewController(activityVC, animated: true, completion: nil) }else { // Change Rect to position Popover let popUp = UIPopoverController(contentViewController: activityVC) popUp.presentPopoverFromRect(CGRectZero, inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true) }


self.dismissViewControllerAnimated(true, completion: nil) let textToShare:String = "Lets have a chat!"; let activityVC:UIActivityViewController = UIActivityViewController(activityItems: [textToShare], applicationActivities: nil) let excludeActivities = [UIActivityTypeAirDrop, UIActivityTypePrint, UIActivityTypeSaveToCameraRoll, UIActivityTypeAssignToContact, UIActivityTypePostToFlickr, UIActivityTypePostToTencentWeibo, UIActivityTypePostToVimeo, UIActivityTypePostToTencentWeibo] activityVC.excludedActivityTypes = excludeActivities activityVC.modalPresentationStyle = UIModalPresentationStyle.FormSheet presentViewController(activityVC, animated: true, completion: nil)