gpt4 book ai didi

ios - NSURl urlWithString 用点替换正文

转载 作者:行者123 更新时间:2023-11-28 21:45:41 26 4
gpt4 key购买 nike

我尝试将 NSString 转换为 NSURL,但是我收到了截断的 url。

NSURL *url = [NSURL fileURLWithPath:music.url];

如果我制作 NSLog music.url 我会得到:

/Users/Nikita/Library/Developer/CoreSimulator/Devices/D93FE148-7F72-43BB-A545-06D76C71300B/data/Containers/Data/Application/48BC6629-F054-4679-AC7B-709815EC5E2A/Library/Caches/4219609-357670045.mp3

当 NSLog 收到 url 时:

/Users/Nikita/Library/Developer/CoreSimulator/Devices/D93FE148-7F72-43BB-A545-06D76C71300B/data/Containers/Data/Applicat ... 0045.mp3

链接被部分截断。

这是什么原因?谢谢

最佳答案

music.ulr 显然是 NSString 的实例。 urlNSURL 的实例。使用 NSLog() 类的实例可以自行决定如何记录。

Objective-C object, printed as the string returned by descriptionWithLocale: if available, or description otherwise. Also works with CFTypeRef objects, returning the result of the CFCopyDescription function.

NSLog() 只打印一个描述,而不是完整的对象,不管它应该是什么。

显然 NSString 的开发者认为打印出完整的字符串是个好主意,并为此编写了一个描述方法。 NSURL的开发者认为只打印部分字符串就足够了,所以你可以识别它。

关于ios - NSURl urlWithString 用点替换正文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30285368/

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