gpt4 book ai didi

iOS 弃用的 dataWithContentsOfMappedFile 替换

转载 作者:搜寻专家 更新时间:2023-11-01 07:30:20 26 4
gpt4 key购买 nike

这行代码:

let pkcs12Data = NSData.dataWithContentsOfMappedFile(path!)

在 XCode 7 中显示警告:

'dataWithContentsOfMappedFile' was deprecated in iOS 8.0: Use +dataWithContentsOfURL:options:error: and NSDataReadingMappedIfSafe or NSDataReadingMappedAlways instead.

但是当我尝试任何建议时,我找不到任何响应建议的方法。有什么想法吗?

谢谢...

最佳答案

应该用作初始化方法:

let pkcs12Data = NSData(contentsOfURL: url, options: options, error: &error)

如果你使用的是 swift 2.x,你应该用 try-statement 包裹起来。

关于iOS 弃用的 dataWithContentsOfMappedFile 替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32870855/

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