gpt4 book ai didi

ios - 如何在 swift 3 中删除名为 .ALAssetsLibraryChanged 的​​观察者

转载 作者:行者123 更新时间:2023-11-30 12:43:25 24 4
gpt4 key购买 nike

我正在将视频编辑器应用从 2.3 转换为 swift 3,但我在 NotificationCenter.default.removeObserver 参数 name: NSNotification.Name.ALAssetsLibraryChanged 处遇到问题> 在 iOS 9.0 中被废弃。我已经将其修改为佩戴 NSNotification.Name.photoLibraryDidChanged ,现在 ot 给了我错误:

Type NSNotification.Name has no member photoLibraryDidChanged

这是完整的代码行:

NotificationCenter.default.removeObserver(self, name: NSNotification.Name.photoLibraryDidChanged, object: photoLibary)

最佳答案

我已经通过使用以下方法成功解决了此问题:

NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: "photoLibraryDidChanged"), object: photoLibary)

代替这个:

NotificationCenter.default.removeObserver(self, name: NSNotification.Name.photoLibraryDidChanged, object: photoLibary)

关于ios - 如何在 swift 3 中删除名为 .ALAssetsLibraryChanged 的​​观察者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41962271/

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