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
TypeScript、上達の瞬間
sadnessojisan
46
13k
SRE×AIOpsを始めよう!GuardDutyによるお手軽脅威検出
amixedcolor
0
190
あなたの知らない Function.prototype.toString() の世界
mizdra
PRO
0
120
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
150
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.4k
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
160
Introduction to Works of ML Engineer in LY Corporation
lycorp_recruit_jp
0
140
日経電子版のStoreKit2フルリニューアル
shimastripe
1
140
Zennのパフォーマンスモニタリングでやっていること
ryosukeigarashi
0
160
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
How STYLIGHT went responsive
nonsquared
95
5.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Embracing the Ebb and Flow
colly
84
4.5k
Happy Clients
brianwarren
98
6.7k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
What's in a price? How to price your products and services
michaelherold
243
12k
Site-Speed That Sticks
csswizardry
0
28
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Designing Experiences People Love
moore
138
23k
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ʹ֎Εͯ͠·ͬͨΒੋඇ