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
Monaca、WKWebViewに移行しようぜ!
Search
Daisuke Kishino
April 02, 2020
Programming
0
850
Monaca、WKWebViewに移行しようぜ!
https://monacaug.connpass.com/event/170995/
の発表資料
Daisuke Kishino
April 02, 2020
Tweet
Share
More Decks by Daisuke Kishino
See All by Daisuke Kishino
Flutterコンテストを開催した話
kishino
1
390
Ionicあらまし@okayama-js
kishino
0
1k
MonacaアプリをネイティブのUXに近づけるために
kishino
0
800
Sign In with Appleを実装してみた
kishino
0
400
Fluid interfaces for Monaca
kishino
0
230
Vue.jsの特徴
kishino
0
600
Monacaでアプリ名の多言語化
kishino
0
690
Other Decks in Programming
See All in Programming
선언형 UI에서의 상태관리
l2hyunwoo
0
230
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
270
iOS開発におけるCopilot For XcodeとCode Completion / copilot for xcode
fuyan777
1
710
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
890
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
110
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
260
Оптимизируем производительность блока Казначейство
lamodatech
0
780
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
130
nekko cloudにおけるProxmox VE利用事例
irumaru
3
490
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
1.1k
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
160
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
600
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1366
200k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
A Tale of Four Properties
chriscoyier
157
23k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
What's in a price? How to price your products and services
michaelherold
244
12k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
The World Runs on Bad Software
bkeepers
PRO
66
11k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
4 Signs Your Business is Dying
shpigford
182
21k
Documentation Writing (for coders)
carmenintech
67
4.5k
How to train your dragon (web standard)
notwaldorf
88
5.8k
Designing Experiences People Love
moore
139
23k
Transcript
MonacaɺWKWebViewʹҠߦ͠Α ͏ͥʂ Daisuke Kishino Monaca UG ONLINE #1 2020.4.2
ࣗݾհ • ϐʔϓϧιϑτΣΞגࣜձࣾ • ؛ େี(@kishisuke) • Ԭࢁݝෑࢢࡏॅ • ͜͜2BaaS@rakuza+MonacaΞϓϦͷ։ൃ
(Vue.jsϝΠϯ) • Monaca UG OKAYAMAͬͯ·͢ • ࠷ۙFlutterΞϓϦ࡞ͬͯ·͢
ൃ https://developer.apple.com/news/?id=12232019b ”App Storeɺ20204݄Ҏ߱ɺUIWebViewΛ༻͢Δ৽͍͠Ξ ϓϦɺ͓Αͼ202012݄Ҏ߱ɺUIWebViewΛ༻͢ΔΞϓϦͷ ΞοϓσʔτΛड͚͚ͳ͘ͳΓ·͢ɻ”
None
Ͳ͏͢Εྑ͍ͷʁ • UIWebViewΛআ͢Δ • ͔ΘΓʹWKWebViewΛ͏ • Ҏ্ʂ
WKWebView is Կ • iOS 8͔Βొͨ͠৽͍͠WebView • ϨϯμϦϯάJSͷ࣮ߦ͕ߴ • ϓϩηε͕ΞϓϦͱ͍ͯ͠ΔʢΫϥογϡ͠ʹ͍͘ʣ
• ηΩϡϦςΟ͕ݫ֨
J04ϦϦʔεɻ8,8FC7JFX͕ొ J04ϦϦʔεɻ6*8FC7JFX͕ඇਪʹͳΔ ͍ۙকདྷ6*8FC7JFXΛؚΉΞϓϦͷਃ͕Ͱ͖ͳ͘ͳΔܯࠂ͕௨ ͞ΕΔʢ*5.4ʣ ৽نɺطଘʹ6*8FC7JFXΛؚΉΞϓϦͷਃ ͕Ͱ͖ͳ͘ͳΔ͜ͱ͕௨͞ΕΔ
.POBDB͕8,8FC7JFXͷαϙʔτΛ։࢝ 6*8FC7JFXΛؚΉ৽نΞϓϦͷਃ͕Ͱ͖ͳ͘ͳΔˡΠϚίί 6*8FC7JFXΛؚΉطଘΞϓϦͷਃ͕Ͱ͖ͳ͘ͳΔ
UIWebViewΛར༻͍ͯ͠Δ͔֬ೝ͢Δํ๏ • UIWebViewΛ࣮ࡍʹը໘ʹද͍ࣔͯ͠ͳ͘ͱɺϦϯΫ͍ͯ͠Δ߹ϦδΣΫτ͞ ΕΔՄೳੑ͕͋Δ • UIWebView͕ϦϯΫ͞Ε͍ͯΔ͔nmίϚϯυͰ֬ೝՄೳ • ※όΠφϦϑΝΠϧͷύεҎԼͰ֬ೝ 1. ipaϑΝΠϧΛղౚ͢Δʢ֦ுࢠΛzipʹมߋͯ͠ɺzipܗࣜͱͯ͠ղౚʣ
2. {ϑΝΠϧ໊}/Payload/{ϑΝΠϧ໊}.app/{ϑΝΠϧ໊} nm <όΠφϦϑΝΠϧͷύε> | grep UIWebView
UIWebViewΛར༻͍ͯ͠Δ͔֬ೝ͢Δํ๏ • ݁ՌྫʢԿදࣔ͞Εͳ͔ͬͨΒOKʣ U _OBJC_CLASS_$_UIWebView U _OBJC_METACLASS_$_UIWebView U _OBJC_CLASS_$_UIWebView U
_OBJC_METACLASS_$_UIWebView
جຊతͳରԠํ๏
WebViewͷEngineΛWKWebViewʹมߋ
WebViewΛWKWebViewʹมߋ WKWebView ʹมߋ
PlatformͱXcodeΛมߋ iOS 5.1.1 ʹมߋ Xcode11.3 ʹมߋ
WKWebView൛ΧελϜσόοΨʔʹରԠ Monaca Core UtilityΛ Ұ୴আ
WKWebView൛ΧελϜσόοΨʔʹରԠ Ճ 2.1.0 ΛΠϯετʔϧ
αʔυύʔςΟϓϥάΠϯͷରԠ
αʔυύʔςΟϓϥάΠϯͷରԠ • αʔυύʔςΟͷϓϥάΠϯͰUIWebViewΛϦϯΫ͍ͯ͠ΔՄೳ ੑ͕͋Δɻ • ͦͷ߹ɺϓϥάΠϯΛΞοϓσʔτ·ͨআʢඞཁͰ͋Ε ସ࣮ʹҠߦʣ͢Δ
ରԠྫ • InAppBrowser • WKWebViewʹରԠ͓ͯ͠ΓɺUIWebViewͷඇϦϯΫԽ3.2.0͔ΒରԠ • Firebase SDK • 6.8.0ͱ6.8.1͔ΒUIWebViewͷඇϦϯΫԽʹରԠʢ6.8.1ະຬͷ߹ཁ
Ξοϓσʔτʣ • AFNetworking • 3.xͰUIWebView͕ϦϯΫ͞Ε͍ͯΔɻ4ͰରԠ൛ΛϦϦʔε༧ఆ
ϋϚͬͨ
LocalStorage
LocalStorageͷσʔλอଘॴ Ҡߦલ Ҡߦޙ Library !"" WebKit !"" LocalStorage !"" file__0.localstorage
Library !"" WebKit #"" LocalStorage $ !"" file__0.localstorage $ !"" WebsiteData !"" LocalStorage !"" file__0.localstorage WKWebView͕ ࢀর ࢀর͞Εͳ͘ͳΔ ʢফ༷͑ͨʹݟ͑Δʣ
LocalStorageͷσʔλΛҠߦ͢Δ • cordova-plugin-migrate-localstorageΛΠϯετʔϧ͢Δ͚ͩ • ϓϥάΠϯͷॳظԽ࣌ʹWebKit/LocalStorage/file__0.localstorage͔ΒWebKit/ WebsiteData/LocalStorage/file__0.localstorageʹϑΝΠϧΛίϐʔ͢Δ • Ωϟογϡσʔλ͔͠LocalStorageʹอଘ͍ͯ͠ͳ͍߹ɺ͋͑ͯҠߦ͢Δඞཁ ͳ͍͔ •
ςετೖ೦ʹ͢ΔʢGoogle Chrome 79ͷ൵ܶΛ܁Γฦ͍͚ͯ͠ͳ͍..ʣ
CordovaͰXHR͕ΤϥʔʹͳΔ
HTTP(S)ͷΞΫηε MonacaΞϓϦ ʢfile://…ʣ API ʢhttps://example.com/…ʣ WKWebView ಉҰੜݩϙϦγʔʹΑΓ XHRͰΞΫηεͰ͖ͳ͍ ϒϥβͱಉ༷ʹ CORSରԠ͕ඞཁ
ϩʔΧϧϦιʔεͷΞΫηε MonacaΞϓϦ ʢfile://…ʣ MonacaΞϓϦ ʢfile://…/page.htmlʣ WKWebView fileεΩʔϜͷϩʔΧϧϦιʔε ʹXHRͰΞΫηεͰ͖ͳ͍
ղܾࡦᶃ: cordova-plugin-wkwebview-file-xhr • cordova-plugin-wkwebview-file-xhr • XHRͷॲཧΛϑοΫͯ͠ɺωΠςΟϒଆʢNSURLSessionʣͰϩʔ ΧϧϑΝΠϧʹΞΫηεͯ݁͠ՌΛฦ͢ • ϓϥάΠϯͷॳظԽྃ͠ͳ͍ͱXHRϦΫΤετͰ͖ͳ͍ʹҙ
ղܾࡦᶄ: Custom SchemeϓϥάΠϯ • ϩʔΧϧϦιʔεʹXHRͰΞΫηε͢ΔͨΊͷMonacaެࣜͷϓϥάΠϯʢ3/31ϦϦʔεʣ • wwwσΟϨΫτϦԼͷϑΝΠϧશମΛΧελϜεΩʔϜΛ௨ͯ͡ΞΫηε͢Δ • fileεΩʔϜͰͳ͍ͷͰΞΫηε੍ݶͳ͠ •
cordova-plugin-wkwebview-file-xhrͱҟͳΓɺϓϥάΠϯͷॳظԽΛͭඞཁͳ͠ monaca-app://monaca.io/www/index.html
ղܾࡦᶄ: Custom SchemeϓϥάΠϯ • ҙ • WKURLSchemeHandlerΛ͍ͬͯΔʢϋζʣͳͷͰɺiOS11Ҏ߱ͷΈରԠ • publicͳnpmϨδετϦͰެ։͞Ε͍ͯͳ͍ͨΊɺϩʔΧϧڥͰnpm installͰ͖ͳ͍
ͦͷଞͷ͕ى͖ͨΒ • ·ͱΊهࣄΛಡΉ • https://qiita.com/kishisuke/items/d201790aeae2129ff2e3 • CordovaͷIssueΛ֬ೝ͢Δ • https://issues.apache.org/jira/issues/? jql=project%20%3D%20CB%20AND%20labels%20%3D%20wkwebview-
known-issues
ྑ͍͜ͱ͋Δ • ύϑΥʔϚϯεͷ্ • ApplePayɺSign in with AppleͳͲͷ࠷৽ػೳʹରԠ͍ͯ͠Δ • UIWebViewͷόά͕Δ
None
None