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
840
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
380
Ionicあらまし@okayama-js
kishino
0
980
MonacaアプリをネイティブのUXに近づけるために
kishino
0
780
Sign In with Appleを実装してみた
kishino
0
390
Fluid interfaces for Monaca
kishino
0
220
Vue.jsの特徴
kishino
0
600
Monacaでアプリ名の多言語化
kishino
0
680
Other Decks in Programming
See All in Programming
Vapor Revolution
kazupon
1
180
みんなでプロポーザルを書いてみた
yuriko1211
0
280
イマのCSSでできる インタラクション最前線 + CSS最新情報
clockmaker
4
1.3k
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
630
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
260
CSC509 Lecture 12
javiergs
PRO
0
160
カンファレンスの「アレ」Webでなんとかしませんか? / Conference “thing” Why don't you do something about it on the Web?
dero1to
1
110
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
710
Outline View in SwiftUI
1024jp
1
340
Jakarta EE meets AI
ivargrimstad
0
290
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
Macとオーディオ再生 2024/11/02
yusukeito
0
380
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
Documentation Writing (for coders)
carmenintech
65
4.4k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
380
Building an army of robots
kneath
302
43k
Faster Mobile Websites
deanohume
305
30k
Side Projects
sachag
452
42k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Making Projects Easy
brettharned
115
5.9k
How GitHub (no longer) Works
holman
310
140k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
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