Development/iOS 개발
iOS17에서 URL(string:) 사용 유의점
Tunko
2023. 10. 10. 00:10
아래 링크를 보시면
RFC 1738/1808 → RFC 3986
로 업데이트 되었다고 합니다.
init(string:) | Apple Developer Documentation
RFC (Request for Comments)는 인터넷 연구 및 개발 커뮤니티에서 인터넷 표준과 관련된 문서의 시리즈입니다. 각 RFC는 번호가 부여되며, 특정 주제나 프로토콜에 대한 정보와 규격을 담고 있습니다.
struct TestUrl {
let testURL = "https://tistory.com"
let testURL2 = "https:// tistory.com"
init() {
if #available(iOS 17.0, *) {
var url_iOS17 = URL(string: testURL)
print("iOS17: \(url_iOS17)") // 결과: my%20string
url_iOS17 = URL(string: testURL2, encodingInvalidCharacters: false)
print("iOS17: \(url_iOS17)") // 결과: nil
} else {
let url_iOS16 = URL(string: testURL2)
print("iOS17: \(url_iOS16)") // 결과: nil
}
}
}
기존엔 nil로 나오던 결과가 다르게 인코딩되어 나오게 됩니다.
반응형