如何从UICollectionViewCell呈现AlertView

我在标题中使用带有Map的UICollectionView。

我想处理核心位置错误。 我有3种错误类型,其中两种我想呈现UIAlertView

但我收到一个错误,因为UICollectionViewCell没有名为presentViewController的成员。

 func locationUnknown() { var alert = UIAlertController(title: "Location Unknown", message: "Please try again later.", preferredStyle: UIAlertControllerStyle.Alert) let alertAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: { (action: UIAlertAction!) -> Void in }) alert.addAction(alertAction) self.presentViewController(alert, animated:true, completion: nil) } 

如何将此UIAlertView发送到UICollectionView的屏幕?

使用窗口的根视图控制器来显示警报:

 self.window?.rootViewController?.present(alert, animated: true, completion: nil)