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
990
空間オーディオを活用しよう!
ridwy
0
430
AVPlayerのHLS再生時のエラーをハンドリングする
ridwy
0
470
AirPlayの裏舞台
ridwy
0
1.8k
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
ネット広告に未来はあるか?「3rd Party Cookie廃止とPrivacy Sandboxの効果検証の裏側」 / third-party-cookie-privacy
cyberagentdevelopers
PRO
1
130
VPC間の接続方法を整理してみた #自治体クラウド勉強会
non97
1
850
話題のGraphRAG、その可能性と課題を理解する
hide212131
4
1.5k
わたしとトラックポイント / TrackPoint tips
masahirokawahara
1
240
AWS re:Inventを徹底的に楽しむためのTips / Tips for thoroughly enjoying AWS re:Invent
yuj1osm
1
570
新卒1年目が挑む!生成AI × マルチエージェントで実現する次世代オンボーディング / operation-ai-onboarding
cyberagentdevelopers
PRO
1
170
Shift-from-React-to-Vue
calm1205
3
1.3k
日経電子版におけるリアルタイムレコメンドシステム開発の事例紹介/nikkei-realtime-recommender-system
yng87
1
500
来年もre:Invent2024 に行きたいあなたへ - “集中”と“つながり”で楽しむ -
ny7760
0
470
君は隠しイベントを見つけれるか?
mujyun
0
290
「 SharePoint 難しい」ってよく聞くけど、そんなに言うなら8歳の息子に試してもらった
taichinakamura
1
620
Figma Dev Modeで進化するデザインとエンジニアリングの協働 / figma-with-engineering
cyberagentdevelopers
PRO
1
430
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
Ruby is Unlike a Banana
tanoku
96
11k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Become a Pro
speakerdeck
PRO
24
5k
Designing for Performance
lara
604
68k
Gamification - CAS2011
davidbonilla
80
5k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Building Adaptive Systems
keathley
38
2.2k
Building Your Own Lightsaber
phodgson
102
6k
5 minutes of I Can Smell Your CMS
philhawksworth
202
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ʹ֎Εͯ͠·ͬͨΒੋඇ