URL Schemes

Photo by Taylor Heery on Unsplash

我方app端

  1. 設定URL Types(定義你app的URL)
    從TARGETS → Info → URL Types → + → URL Schemes輸入你自己的自訂名稱
ex: URLSchemes = rilinkshop, 你的連結為rilinkshop://
  • **scene(_:openURLContexts:) → 詢問delegate跳至特定一或多頁面
  • openURLContexts內有包含一或多個UIOpenURLContext物件,物件則有一個URL和附帶資訊(optional),取出他的url資訊
  • scheme對應原本自定義scheme,path則是為特定頁面定義的路徑
    ex: 這邊有分別要跳至/shop跟/ticket頁面

對方app端(準備跳轉到你的app)

  1. 設定LSApplicationQueriesSchemes
    在Info.plist輸入LSApplicationQueriesSchemes
ex: appURL = URL(string: “rilinkshop”),後面的路徑(host)則是有打算前往特定功能頁面再加上去

--

--

On my way to become an iOS developer!

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store