gpt4 book ai didi

swift - 在 UIAlertController 给出 _BSMachError 之后呈现 UIActivityViewController

转载 作者:搜寻专家 更新时间:2023-11-01 05:37:28 37 4
gpt4 key购买 nike

我有一个触发 UIActivityViewController 显示的 UIAlertAction。我如何确保 UIAlertController 被关闭,以便在显示 UIActivityViewController 时我不会收到如下所示的错误 _BSMachError。如何从 UIAlertAction 处理程序中正确关闭 UIAlertController?我查看了 SO 上的各种帖子,认为是这个问题导致了错误消息,但当然可能不是!!

第一个 UIAlertController 是:

 func presentDone() {
let doneAlert = UIAlertController(title: "Done!",
message: "",
preferredStyle: .Alert)

let sendLater = UIAlertAction(title: "Send Later", style: .Default) {action -> Void in}
let sendCode = UIAlertAction(title: "Send Now", style: .Default, handler: sendCodeAlert)
doneAlert.addAction(sendCode)
doneAlert.addAction(sendLater)
self.presentViewController(doneAlert, animated: true, completion: nil)
}

当按下 sendCode 按钮时,出现 _BSMachError: (os/kern) invalid capability (20) _BSMachError: (os/kern) invalid name (15)。

func sendCodeAlert(alert: UIAlertAction) {

let message: String = "Hi! Ready to go!"
let postItems: [AnyObject] = [message]
let controller: UIActivityViewController = UIActivityViewController(activityItems: postItems, applicationActivities: nil)

if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Phone {
self.presentViewController(controller, animated: true, completion: nil)
} else {
let popup: UIPopoverController = UIPopoverController(contentViewController: controller)
popup.presentPopoverFromRect(CGRectMake(self.view.frame.size.width / 2, self.view.frame.size.height / 4,0,0), inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)
}
}
}

感谢任何对此有想法的人。

最佳答案

我总是在多个地方遇到这个错误,但它从来没有造成任何问题。忽略它似乎是安全的。

关于swift - 在 UIAlertController 给出 _BSMachError 之后呈现 UIActivityViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35151980/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com