最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

swift - Issue with NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true) - Stack Overflow

programmeradmin2浏览0评论

I have universal links setup in my ios app. everything is working to a point, I am using the following url as a test: []

I have the following code inside my scenedelegate:

func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
    guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
          let incomingURL = userActivity.webpageURL,
          let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true),
          let path = components.path,
          let queryItems = components.queryItems else {
            return
    }
}

I get the incoming URL as I expect.

Components returns nothing, it drops to the return statement and ends.

I am not sure what I'm doing wrong with this so any suggestions would be appreciated.

发布评论

评论列表(0)

  1. 暂无评论