gpt4 book ai didi

ios - UIDocumentInteractionController PresentOpenInMenuFromRect

转载 作者:行者123 更新时间:2023-11-30 14:15:48 24 4
gpt4 key购买 nike

我有从 UIAlertController 中调用的代码:

func createSomeFile() {

var output = (some NSData to output to file)


let fileName = NSTemporaryDirectory().stringByAppendingPathComponent("filename.ext")
let url: NSURL! = NSURL(fileURLWithPath: fileName)

var dataToWrite = output.dataUsingEncoding(NSUTF8StringEncoding)
dataToWrite?.writeToFile(url.absoluteString!, atomically: true)

documentController = UIDocumentInteractionController(URL: url)
documentController.UTI = "com.someUTI"
documentController.delegate = self

documentController.presentOpenInMenuFromRect(CGRectZero, inView: self, animated: true)
}

最后一行在 Xcode 中引发错误:“无法使用类型的参数列表调用 'presentOpenInMenuFromRect'...”

documentController 被声明为类变量var documentController = UIDocumentInteractionController()

请帮我解决这个问题。

最佳答案

您无法分配 self一个参数应该是 UIView (除非 selfUIView 的子类,但显然不是)

所以试试这个:

documentController.presentOpenInMenuFromRect(CGRectZero, inView: self.view, animated: true)

关于ios - UIDocumentInteractionController PresentOpenInMenuFromRect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31201355/

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