Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xcode15+ios17beta cannot adapt with https or http pattern #166

Open
devAlanHey opened this issue Jul 14, 2023 · 8 comments
Open

xcode15+ios17beta cannot adapt with https or http pattern #166

devAlanHey opened this issue Jul 14, 2023 · 8 comments

Comments

@devAlanHey
Copy link

devAlanHey commented Jul 14, 2023

When I run my project with Xcode15 beta-4 and iOS17 beta-3, something is wrong with the URLNavigator.
image
cannot work expected;

image

when the value of candidate is "https://" or "http://", candidate.urlValue is nil.

@devAlanHey
Copy link
Author

waiting for release Xcode15 and iOS17

@Jinya
Copy link

Jinya commented Aug 20, 2023

I met the same bug(or a feature?) when using Xcode 15 Beta 6 + iOS 17.0 Simulator(Beta 6).

Meanwhile, Xcode 14.3.1 + iOS 17.0 Simulator(Beta 6) works.

@devAlanHey
Copy link
Author

@Jinya yeah, the same encounter!
It‘s seems apple's issue. Apple fixed a series of beta issues including the ones I encountered. The official version is expected to resolve this issue.

Be patient and wait.

@devAlanHey devAlanHey reopened this Aug 21, 2023
@jiasongs
Copy link

jiasongs commented Sep 12, 2023

+1, it's not fixed in iOS 17 beta 8

@MainByElse
Copy link

MainByElse commented Sep 12, 2023

Is this change causing this problem? @devAlanHey @devxoul

image
https://developer.apple.com/documentation/foundation/nsurl/1572047-urlwithstring

@JasonXZJ
Copy link

+1, it's not fixed in release Xcode15 and iOS17

@ETmanwenhan
Copy link

I met the same bug(or a feature?) when using Xcode 15.0 + iOS 17.1 Simulator

Meanwhile, Xcode 15.0 + iOS 17.1 Simulator works.

@quntion
Copy link

quntion commented Oct 11, 2023

只要稍微修改下匹配规则即可,将<>匹配修改为[]匹配,例如:

路由注册的代码
navigator.register("https://[path:_]") { url, _, _ -> UIViewController? in .... return vc }

URLNavigator 库中的 URLPathComponent.swift 中

extension URLPathComponent {
init(_ value: String) {
/*
Xcode15 和 iOS 17 修改了URL的有效性校验规范,导致这种情况下无法有效初始化 URL,修改为 [path:_] 这种即可解决该问题

 苹果:https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes
 Github:https://github.com/devxoul/URLNavigator/issues/166
 */
//if value.hasPrefix("<") && value.hasSuffix(">") {
if value.hasPrefix("[") && value.hasSuffix("]") {
  let start = value.index(after: value.startIndex)
  let end = value.index(before: value.endIndex)
  let placeholder = value[start..<end] // e.g. "<int:id>" -> "int:id"
  let typeAndKey = placeholder.components(separatedBy: ":")
  if typeAndKey.count == 1 { // any-type placeholder
    self = .placeholder(type: nil, key: typeAndKey[0])
  } else if typeAndKey.count == 2 {
    self = .placeholder(type: typeAndKey[0], key: typeAndKey[1])
  } else {
    self = .plain(value)
  }
} else {
  self = .plain(value)
}

}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants