Skip to content

Latest commit

Β 

History

History
131 lines (103 loc) Β· 4.09 KB

What-s-New-in-Universal-Links.md

File metadata and controls

131 lines (103 loc) Β· 4.09 KB

What's New in Universal Links

πŸ“… 2019.11.18 (μ›”)

WWDC2019 | Session : 717 | Category : Networking

πŸ”— What's New in Universal Links - WWDC 2019 - Videos - Apple Developer

Overview

Universal Link

  • μ›Ήκ³Ό μ•±μ˜ resource λ₯Ό κ°€λ¦¬ν‚€λŠ” Apple OSκ°€ μΈμ‹ν•˜λŠ” http λ˜λŠ” https 둜 된 URL μ‚¬μš©μžκ°€ 앱을 μ„€μΉ˜ν–ˆλ˜, λ‹€μš΄ 받지 μ•Šμ•˜λ˜, ν•˜λ‚˜μ˜ URL은 μ½˜ν…μΈ λ₯Ό λŒ€ν‘œν•œλ‹€.
  • μ•±κ³Ό μ›Ήμ‚¬μ΄νŠΈ κ°„ μ•ˆμ „ν•˜κ²Œ μ—°κ΄€ λ˜μ–΄ μžˆλ‹€. λŒ€ν‘œ ν•  수 μžˆλŠ” 도메인을 json ν˜•μ‹μœΌλ‘œ μ„œλ²„μ—μ„œ 가지고 있고, μ•±μ—μ„œ 도메인을 μ μš©ν•˜λ©΄ λœλ‹€.
  • custom URL scheme 을 universal link둜 λ°”κΎΈλŠ” 것을 ꢌμž₯ν•œλ‹€. cutom URL은 본질적으둜 μœ„ν—˜ν•˜κ³  μ•…μ˜μ μΈ κ°œλ°œμžλ“€μ— μ˜ν•΄ μ•…μš© 될 수 μžˆλ‹€.

Configuring Your Web Sever

  • μ›Ή μ„œλ²„μ—μ„œλŠ” μœ νš¨ν•œ HTTPS μΈμ¦μ„œκ°€ μžˆμ–΄μ•Ό ν•œλ‹€.
  • apple-app-site-association νŒŒμΌμ„ μΆ”κ°€ν•œλ‹€. μ• ν”Œ λ””λ°”μ΄μŠ€μ— 앱을 μ„€μΉ˜ν•˜λ©΄ μš΄μ˜μ²΄μ œκ°€ μ„œλ²„κ°€ μ–΄λ–€ μ„œλΉ„μŠ€λ₯Ό μ•±μ—μ„œ μ‚¬μš©ν•˜κ²Œ ν•  지 κ²°μ •ν•˜κΈ° μœ„ν•΄ 이 νŒŒμΌμ„ λ‹€μš΄λ‘œλ“œ ν•œλ‹€. https://example.com/.well-known/apple-app-site-association 에 μ €μž₯λ˜μ–΄μ•Ό ν•œλ‹€.

apple-app-site-association file

    {
    	"applinks": {
    		"apps": [],
    			 "details": [
    			 {
    				 "appID": "ABCDE12345.com.example.app",
    				 "path": ["/path/*/filename"]
    				 "components": [
    						{
    							"/": "/path/*/filename",
    							"#": "*fragment",
    							"?": { "widget": "?*", "grommet": "please" }						
    						},
    						{
    							{"/": "/taco/*", "exclude": true}
    						}
    					]
    			}
    		]
    	},
    }
  • iOS 13, tvOS13, macOS 10.15 λ₯Ό νƒ€κ²ŸνŒ… ν•œλ‹€λ©΄ appsλŠ” 제거 κ°€λŠ₯ν•˜λ‹€.
  • appID : App Identifier β†’ Appleμ—μ„œ 제곡된 10자리 숫자.bundleID, λ°°μ—΄λ‘œ μ—¬λŸ¬ μ•±μ—μ„œ 같은 universal link μ‚¬μš© κ°€λŠ₯
  • path β†’ components 둜 λŒ€μ²΄λ¨
  • URL fragment component λ₯Ό # ν‚€λ‘œ, query ? 둜 λŒ€μ‘ ν•  수 μžˆλ‹€. query item을 dictionary둜 λ‚˜νƒ€λ‚Ό 수 μžˆλ‹€.
  • "exclude": trueμ‹œ μ œμ™Έ

Internationalization

  • URL κ³Ό pattern-matching은 ASCII
  • μ§€μ›ν•˜λŠ” λͺ¨λ“  ꡭ가에 λŒ€ν•œ country-specific pattern 이 ν•„μš”ν•˜λ‹€. { "en", "fr", "mx", ... } β†’ "??" {"en_US", "fr_CA", "de_CH", ...} β†’ "??_??"
  • .com, .net, .org, ccTLD μš°μ„ μˆœμœ„

Configuring Your App

Project β†’ add Associated Domains

    <array>
    	<string>applinks:www.exapmle.com</string>
    	<string>applinks:*.exapmle.com</string>
    	<string>applinks:xn--fhqz97e.exapmle.xn--fiqs8s</string>
    </array>

More specific subdomains have higher priority

Internationalized domains must be encoded as Punycode

    func application(_ application: UIApplication, continue userActivity: NSUserActivity,
    restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    	guard userActivity.activityType == NSUserActivityTypeBrowsingWeb, 
    	let url = userActivity.webpageURL,
    	let components = URLComponents(url: url, resolvingAgainstBaseURL: true) else {
    		return false
    	}
    
    	for queryItem in components.queryItems ?? [] {
    		 ...
    	}
    	
    	return true
    }

macOS Differences

Opening Universal Links

UIApplication

    UIApplication.shared.open(url, options: [.universalLinksOnly: true]) {
    	...
    }

NSWorkspace

    let configuration = NSWorkspace.OpenConfiguration()
    configuration.requiresUniversalLinks = true
    NSWorkspace.shared.open(url, configuration: configuration) {
    	...
    }

Best Practice

  • Fail gracefully 기간이 만료 λ˜μ—ˆκ±°λ‚˜, μœ νš¨ν•˜μ§€ μ•Šκ±°λ‚˜, μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” μ½˜ν…μΈ  일 λ•Œ universal linkκ°€ μ•±μ—μ„œ μ—΄ 수 μ—†λ‹€λ©΄, Safari View Controllerλ₯Ό 톡해 μ—΄μ–΄ 주자. μ΅œμ†Œν•œ μ–΄λ–€ 이슈 인지 ν‘œμ‹œ ν•΄μ£Όμž.
  • Use the Smart App Banner μ‚¬μš©μžκ°€ 웹을 λ°©λ¬Έν–ˆλ‹€λ©΄, smart bannerλ₯Ό μ‚¬μš©ν•΄μ„œ μ•±μŠ€ν† μ–΄λ‚˜ μ•±μ˜ μ½˜ν…μΈ λ‘œ 링크λ₯Ό μ œκ³΅ν•˜μž.