Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Universal Links対応をした話
Search
Chiharu Nameki
May 29, 2017
Technology
2
870
Universal Links対応をした話
iOS 10時代のDeep Link技術
potatotips #40
Chiharu Nameki
May 29, 2017
Tweet
Share
More Decks by Chiharu Nameki
See All by Chiharu Nameki
空間ビデオフォーマット、MV-HEVCが写し撮る世界
ridwy
2
1.3k
空間オーディオを活用しよう!
ridwy
0
440
AVPlayerのHLS再生時のエラーをハンドリングする
ridwy
0
510
AirPlayの裏舞台
ridwy
0
1.9k
AVPlayerできちんとコンテンツ保護
ridwy
0
1.7k
検証 SharePlay media playback
ridwy
1
1.8k
カスタムInstrumentsでアプリをピカピカに!
ridwy
5
11k
チケットなくても楽しかったよ!WWDC19 周辺現地レポート
ridwy
0
640
Firebase Dynamic Links 導入事例
ridwy
6
2.7k
Other Decks in Technology
See All in Technology
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
kargoの魅力について伝える
magisystem0408
0
200
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
300
AIのコンプラは何故しんどい?
shujisado
1
190
NilAway による静的解析で「10 億ドル」を節約する #kyotogo / Kyoto Go 56th
ytaka23
3
370
UI State設計とテスト方針
rmakiyama
2
440
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
100
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
26
11k
Storage Browser for Amazon S3
miu_crescent
1
140
マイクロサービスにおける容易なトランザクション管理に向けて
scalar
0
110
サービスでLLMを採用したばっかりに振り回され続けたこの一年のあれやこれや
segavvy
2
390
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
40
7.1k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Being A Developer After 40
akosma
87
590k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
97
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Making Projects Easy
brettharned
116
5.9k
Embracing the Ebb and Flow
colly
84
4.5k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
BBQ
matthewcrist
85
9.4k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Transcript
Universal LinksରԠΛͨ͠ iOS 10࣌ͷDeep Linkٕज़ 2017/5/24 potatotips #40 @ Rettyגࣜձࣾ
iOS/Android։ൃTipsڞ༗ձ ߦ ઍय़
ࣗݾհ ߦ ઍय़ʢͳΊ͖ ͪΔʣ ੲ macOS͚ΞϓϦɾϛυϧΣΞ։ൃऀ → ࠓ iOSΞϓϦ։ൃऀ גࣜձࣾαΠόʔΤʔδΣϯτ
AmebaΞϓϦ୲ ΞϝϒϩͷߘɾӾཡΞϓϦͰ͢ʂ גࣜձࣾ nana music ԻָίϥϘϨʔγϣϯΞϓϦ nana ԻΤϯδϯ࡞ऀ Իॲཧٕज़͕͖Ͱ͢
Ϟνϕʔγϣϯ • Universal LinksiOS 9Ҏ߱ͷػೳ • iOS 10͕ීٴͨ͠ࠓɺαʔϏεʹಋೖ͘͢͠ͳͬͨ • ࣮ࡍʹରԠͯ͠ಘΒΕͨݟʢൃද࣌ͷใ͔ΒͷΞοϓσʔ
τͳͲʣΛ·ͱΊΔ
͓͞Β͍ ~ ϢʔβࢹͰݟͨUniversal Links ~ HTTP·ͨHTTPSͷϦϯΫΛλοϓͨ࣌͠ʹ υϝΠϯʹରԠ͢ΔΞϓϦ͕ىಈ͢Δ
Universal Linksܦ༝ͰΞϓϦ͕։͍ͨ࣌ͷεςʔλεόʔ SafariͰදࣔ ʢࠓޙSafariͰ։͘Α͏ʹͳΔʣ ભҠݩΞϓϦʹΔ
SafariͰදࣔ࣌ʹԼʹҾͬுΔͱ ΞϓϦͰ։ͨ͘Ίͷόʔ͕ग़ݱ ʮ։͘ʯΛબͿͱ࠶ͼΞϓϦͰ։͘Α͏ʹͳΔ ͜ͷखॱʹΑΓɺΞϓϦͰ։͔͘SafariͰ։͔͘Ϣʔβ͕બՄೳ ʢਖ਼Θ͔Γʹ͍͘ʣ
ΞϓϦ͕ىಈ͢Δ݅ • Ϣʔβ͕SafariͰ։͘͜ͱΛબ͍ͯ͠ͳ͍ • iOS 9Ҏ߱ • ΞϓϦ͕Πϯετʔϧ͞Ε͍ͯΔ ະΠϯετʔϧͷ߹ɺૢ࡞தͷΞϓϦͰͦͷ··ભҠ ετΞཱ͕͕ͪ͋ͬͨΓ͠ͳ͍
• ಉҰυϝΠϯͷભҠͰͳ͍ ݫີʹεΩʔϚ͕ҟͳΔ߹ىಈͨ͠ e.g.) http://hoge.com/ ͔Β https://hoge.com/ ͷભҠ
• Entitlement ͷ Associated Domainsʹapplinks:Λ͚ͭͯυϝΠϯΛهࡌ e.g. applinks:example.com • Universal Linksܦ༝ͰΞϓϦ͕։͔Εͨ࣌ʹݺΕΔϝιουΛ࣮
• ѻ͑ͳ͍URLopen(_:options:completionHandler:)Ͱ։͖͢ ΞϓϦཱ͕͕ͪ͋ͬͨޙɺ͞ΒʹผΞϓϦ͕ىಈ͢ΔͷͰUX্͍·͍ͪɻ ͳΔ͘ൃੜ͠ͳ͍Α͏ʹ͍ͨ͠ɻ ͓͞Β͍ ~ ΞϓϦଆͷରԠ ~ func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {}
• AASA (apple-app-site-association) ϑΝΠϧΛஔ • ϧʔτ·ͨ .well-known αϒσΟϨΫτϦԼʹஔ͘ • HTTPSͰΞΫηεͰ͖ΔΑ͏ʹ͢Δ
HTTPͰμϝ, ϦμΠϨΫτNG • ΞϓϦͷΠϯετʔϧɺ·ͨΞοϓσʔτ࣌ʹOSʹऔಘ͞ΕΔ αʔόΤϥʔʢ500ܥʣͷ߹ɺ3࣌ؒޙʹ࠶औಘ ͓͞Β͍ ~ αʔόଆͷରԠ ~ https://developer.apple.com/reference/security/shared_web_credentials API Reference: Shared Web Credentials ΑΓ
AASA (apple-app-site-association) ϑΝΠϧ { "applinks": { "apps": [], "details": [
{ "appID": "XXXXXXXXXX.jp.co.hoge.AppName", "paths": [ "NOT /_*", "*" ] }, { "appID": "YYYYYYYYYY.jp.co.choge.AppName-ota", "paths": [ "NOT /_*", "*" ] } ] } } AppIDͷPrefixΛࢦఆ ੲͳ͕ΒͷΞϓϦͰ νʔϜIDͱҟͳΔͷͰҙ ←
AASAϑΝΠϧͷهड़ํ๏ • detailspathઌ಄͔ΒධՁ͞ΕΔ • Ϛονͨ͠Βͦ͜ͰධՁΛऴྃ • ෳͷΞϓϦ͕هड़ & Πϯετʔϧ͞Ε͍ͯͨΒɺઌʹॻ͔Εͯ ͍Δํ্ཱ͕͕ͪΔ
• PathͷϚονϯάϧʔϧ • ΫΤϦϑϥάϝϯτରʹͳΒͳ͍ • ? … ҙͷ1จࣈ (/OK) • * … ҙͷจࣈྻʢ0จࣈͰ/͕͍ࠞͬͯͯ͟ྑ͍ʣ • NOT iOS 9.2Ҏ߱ • ࠷ޙͷεϥογϡͷ༗ແϚονϯάʹد༩͠ͳ͔ͬͨ ղऍOSόʔδϣϯʹґଘ͢ΔͷͰҙͯ͠ςετ͢Δ
func open(_ url: URL, options: [String : Any] = [:],
completionHandler completion: ((Bool) -> Void)? = nil) ΞϓϦ͔ΒURLΛUniversal Linksͱͯ͠։͘ʹ UIApplication ͷ open() ϝιουΛ͏ • ֎෦ΞϓϦͰ։͚͔ͨͲ͏͔ͷ݁Ռ͕औಘͰ͖Δ • ࣗࣗͷରԠυϝΠϯͷURLΛ͢ͱSafari͕ىಈ͢Δ iOS 10Ҏ߱ iOS 9Ҏલͷ open(_ : URL) -> Bool ͱൺֱ͢Δͱ • ։͚ΔURLͷλΠϓΛUniversal LinksͷΈʹݶఆՄ • ඇಉظʹͳͬͨ
open()ϝιουΛݺͿͱ ֎෦ΞϓϦͰ։͘લʹ ֬ೝμΠΞϩάΛग़ͯ͘͠ΕΔΑ͏ʹͳͬͨ
ʮΞϓϦͰ։͘ʯόʔ • SafariͷUI • දࣔΧελϚΠζෆՄ • දࣔ͞ΕΔ݅ • ରԠΞϓϦΛΠϯετʔϧࡁΈ •
ରԠυϝΠϯΛSafariͰ։͘ઃఆʹ͍ͯ͠Δ • HTMLʹSmart App BannerͳͲͷهड़ඞཁͳ͍
ਪଌɿiOS͕࣮ࡍʹԿΛ͍ͯ͠Δ͔ • iOS্ʹυϝΠϯ - ΞϓϦͷϚοϐϯάใ͕ଘࡏ • ΞϓϦͷΠϯετʔϧ/Ξοϓσʔτ࣌ʹϚοϐϯάใΛߋ৽ • URLΛ։͘ࡍɺURLͷυϝΠϯʹରԠΞϓϦ͕ଘࡏͨ͠ΒΞϓϦͰ ։͘
΄΅্ͷॲཧͰΓཱ͍ͬͯΔػೳ
iOS 9ͱiOS 10Ͱͷڍಈͷҧ͍ iOS 9 ࠷ॳͷϦΫΤετ͕Universal Linksͷͱ͖ͷΈΞϓϦ͕ىಈ͢Δ iOS 10
ϦμΠϨΫτઌ͕Universal Linksͷ߹ΞϓϦ͕ىಈ͢Δ ࠷ॳͷϦΫΤετͱϦμΠϨΫτઌ͕ͲͪΒUniversal Linksͩͬͨ߹ɺ application(application:continueUserActivity:restorationHandler:) ͕2ճݺͼग़͞ΕΔ ϦμΠϨΫτ࣌ͷڍಈ͕ҟͳ͍ͬͯͨ
ςετํ๏ʢӡ༻લʣ • STGͰٕज़ݕূ • ຊ൪ʹAASAϑΝΠϧΛஔͯ͠ςετ STGͷURLGoogleͳͲʹΠϯσοΫε͞Ε͍ͯͳ͍ͨΊ Ϣʔβମݧ͕Ͳ͏มΘΔ͔ͷݕূʹຊ൪Λ͏ඞཁ͕͋Δ • AASAϑΝΠϧʹυϝΠϯґଘͷใ͕ͳ͍ͨΊɺSTGͱຊ൪Ͱ ಉ͡ϑΝΠϧΛར༻Մೳ
• ΞϓϦͷ Associated Domains ΛڥʹΑͬͯॻ͖͑Δ
ςετํ๏ʢӡ༻ޙʣ ϢʔβମݧͷݕূͷͨΊʹຊ൪ͷAASAϑΝΠϧΛߋ৽ʁʂ … ͢ΔΘ͚ʹ͍͔ͳ͍ ϓϩΩγΛར༻͢ΔͳͲͯ͠ϧʔςΟϯάΛ host ॻ͖͑ proxy ຊ൪ IP:
xxxxxxx ͔ࣾΒͷΈݟ͑Δ ຊ൪ڥ
ӡ༻্ͷ՝ • ػೳΛΓͨ͠ΓɺڍಈΛมߋ͢Δʹ ΞϓϦͷΞοϓσʔτ͕ඞཁ AASAϑΝΠϧΛߋ৽ͯ͠ɺΞϓϦͷΞοϓσʔτͷλΠϛϯάͰ͔͠औಘ͠ʹདྷ ͯ͘Εͳ͍ • ΞϓϦόʔδϣϯͱAASAϑΝΠϧͷ߹ੑͷอͪํ •
ϦϑΝϥͳͲྲྀೖݩͷใ͕औಘͰ͖ͳ͍ͨΊɺSEOͷ؍ͰࠔΔ
ϢʔβͷԠ • ͍͖ͳΓΞϓϦ͕։͘Α͏ʹͳͬͯ͏͍͟ • ݩʹ͍ͨ͠ͱ͍͏͍߹Θ͕ͤདྷͨ ˠ ૢ࡞ํ๏ΛҊ ΉΈʹΞϓϦ͕։͘ͷετϨε αʔϏεͷՁΛຊʹߴΊΒΕ
Ϣʔβʹೲಘײͷ͋ΔॴͰΘͳ͍ͱ͍͚ͳ͍
Appendix: Custom URL Scheme is dead? • URL͕։͚Δ͔Ͳ͏͔Λ֬ೝ͢Δ canOpenURL() iOS
9Ҏ߱ info.plistʹεΩʔϚͷهࡌ͕ඞཁʹͳͬͨ • iOS 8ҎલΘΓʹ canOpenURL() ͷݺͼग़͠ճ͕50ճʹ੍ݶ͞Ε͍ͯͨ • ࣮ࡍʹΞϓϦΛ։͘ open() ϝιουʹ੍ݶ͕ͳ͍ • open()ϝιου͕֎෦ΞϓϦͰ։͘લʹ֬ೝμΠΞϩάΛग़ͯ͘͠ ΕΔΑ͏ʹͳͬͨ ेར༻Մೳ
ΧελϜεΩʔϚ࠷େͷ ΞϓϦ͕Πϯετʔϧ͞Ε͍ͯͳ͍ͱ SafariͰʮϖʔδΛͻΒ͚·ͤΜʯΤϥʔ͕දࣔ͞ΕΔ ެ։͞Ε͍ͯΔWeb໘ʹ͏ͷݫ͍͠ ΞϓϦؒભҠͰར༻͢Δʹ open()ϝιουͰΤϥʔϋϯυϦϯάͰ͖ΔͷͰྑͦ͞͏
ॴײ ศརͦ͏੍͕ͩݶ͕ଟ͘ɺ͍ॴ͕͍͠
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠
WWDC 2017ʹࢀՃ͠·͢ Ͱ͖ͨͯͷApple ParkʹߦͬͯΈ͍ͨ
ࠂɿCyberAgentͰલޙʹΠϕϯτΛ։࠵͠·͢ WWDCલ Pre-WWDC Gathering https://cyberagent.connpass.com/event/55235/ 5/30 19:30~ ौ୩ϓϥΠϜϓϥβ4F Creative Lounge
WWDCޙ CA.swift #3 WWDC 2017 Reporting 6/19 ϙςν #41ʹ֎Εͯ͠·ͬͨΒੋඇ