【发布时间】:2019-08-31 16:52:49
【问题描述】:
URLComponents.init(url:resolvingAgainstBaseURL:) 的文档说:
返回已初始化的 URL 组件对象,如果无法解析 URL,则返回 nil。
知道:
- Swift URL/NSURL 用于基于 RFC 1808、RFC 1738 和 RFC 2732 的 URL:https://developer.apple.com/documentation/foundation/nsurl
- Swift URLComponents/NSURLComponents 用于基于 RFC 3986 的 URL:https://developer.apple.com/documentation/foundation/nsurlcomponents
我假设当 URL 符合 RFC 1808/1738/2732 但不符合 RFC 3986 时,URLComponents 的初始化将失败。那是什么类型的 URL?有什么例子吗?
到目前为止,我唯一的提示可能与不同的保留字符有关?
【问题讨论】:
标签: swift url nsurl rfc3986 nsurlcomponents