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.1k
空間オーディオを活用しよう!
ridwy
0
440
AVPlayerのHLS再生時のエラーをハンドリングする
ridwy
0
490
AirPlayの裏舞台
ridwy
0
1.9k
AVPlayerできちんとコンテンツ保護
ridwy
0
1.6k
検証 SharePlay media playback
ridwy
1
1.7k
カスタムInstrumentsでアプリをピカピカに!
ridwy
5
11k
チケットなくても楽しかったよ!WWDC19 周辺現地レポート
ridwy
0
630
Firebase Dynamic Links 導入事例
ridwy
7
2.6k
Other Decks in Technology
See All in Technology
Engineer Career Talk
lycorp_recruit_jp
0
150
dev 補講: プロダクトセキュリティ / Product security overview
wa6sn
1
2.3k
Why does continuous profiling matter to developers? #appdevelopercon
salaboy
0
190
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
170
Terraform未経験の御様に対してどの ように導⼊を進めていったか
tkikuchi
2
430
Platform Engineering for Software Developers and Architects
syntasso
1
520
SSMRunbook作成の勘所_20241120
koichiotomo
2
130
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
520
Application Development WG Intro at AppDeveloperCon
salaboy
0
180
Taming you application's environments
salaboy
0
180
スクラム成熟度セルフチェックツールを作って得た学びとその活用法
coincheck_recruit
1
140
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
2
590
Featured
See All Featured
How to Ace a Technical Interview
jacobian
276
23k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Scaling GitHub
holman
458
140k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Building an army of robots
kneath
302
43k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
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ʹ֎Εͯ͠·ͬͨΒੋඇ