Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
600件のPull RequestからみたXamarinのはまりどころ
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Nobuhiro Ito
May 07, 2016
Technology
4.4k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
600件のPull RequestからみたXamarinのはまりどころ
2016/05/07(Sat) Japan Xamarin User Group #13 Xamarinのすべて!
Nobuhiro Ito
May 07, 2016
More Decks by Nobuhiro Ito
See All by Nobuhiro Ito
Introduction of Aizome - 多言語対応とスタイル適用を両立する書式付き文字列ライブラリ
iseebi
0
170
Bitriseで本をビルドする / Build a book with Bitrise
iseebi
0
170
BitriseでmacOSアプリをビルドする / Build macOS apps with Bitrise
iseebi
1
880
iOS/Androidアプリ転送ツール TransporterPadの紹介
iseebi
0
6.2k
Apple Developer Enterprise Program でどこまでいけるのか
iseebi
0
810
ReactiveProperty を使ったアプリの設計に Realm Xamarin を組み合わせる
iseebi
0
680
ReactiveProperty で Xamarin アプリの作り方が変わった
iseebi
3
1.8k
Yet Another Cross Platform Development
iseebi
0
4.3k
XamarinでPDFを作る
iseebi
1
1.8k
Other Decks in Technology
See All in Technology
GoにおけるFFIのこれまでとこれから
goccy
4
1.9k
HRC_Frontend_Conference_Fukuoka_2026.pdf
ts020
0
240
Sigmaで作る業務アプリ
kazushiro_honma
0
110
リージョンの壁を越える、 ちょっと変わったAWSサービスの話
falken
PRO
1
300
プロダクトエンジニアに必要な「いい感じ」に作る能力 〜たくさん作れる時代に、どこまで作るかの決め方〜
jnishime_dresscode
2
1.4k
Adaptive Warehouse を今すぐ導入すべき理由と迷ったときの判断基準
__allllllllez__
0
150
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
240
Reactの設計論
uhyo
14
7k
2026-09-04 SRE Tech Talk #15 怠惰なTerraform / Lazy Terraform
masasuzu
0
230
PfEingのアプローチで働こう
rindrics
0
210
Omarchy Quattro の日本語設定周り
simosako
2
130
DEFCON34-Write-up_HYCu-MYCu
daikiokazaki
0
130
Featured
See All Featured
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
970
Building an army of robots
kneath
306
46k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
560
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
490
Chasing Engaging Ingredients in Design
codingconduct
0
300
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
4 Signs Your Business is Dying
shpigford
187
23k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
520
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Transcript
600݅ͷPull Request ͔ΒΈͨ Xamarin ·ΓϙΠϯτ Nobuhiro Ito / Fenrir Inc.
@ Japan Xamarin User Group Conference #13, 2016/05/07(Sat)
@iseebi Nobuhiro Ito Fenrir Inc. Smartphone App Engineer http://iseebi.hatenablog.com/
ձࣾͱͯ͠Xamarinྺ2Ҏ্ ా͞Μ͕XamarinऔΓѻ͍͡ΊΔલ͔ΒͬͯΔ
MvvmCross Ψν ͨͩ࠷ۙͬͱଞͷͷΛࢼ͍ͨ͠ͱࢥͬͯΔ… ※px୯ҐͰϨΠΞτࢦ͕ࣔඈΜͰ͘ΔͷͰFormsͰରॲͰ͖ͳ͍
࠷ۙͷ͓ࣄ ΞϓϦͷ։ൃͷ͔ͨΘΒɺύοέʔδͷϓϩμΫτΦʔφʔͬͯ·͢ɻ
͋ΔϓϩδΣΫτͷ͓Λ͠·͢
ϓϩδΣΫτͷཧମ੍ͷมԽ • 2011, 2012 ωΠςΟϒ / Subversion (2012ͷ్த͔ΒgitҠߦ), Redmine •
2013, 2014 Xamarin / git, Redmine, Backlog, TeamGantt • 2015 Xamarin / GitHub Enterprise, Redmine, Backlog, TeamGantt
GitHub Enterprise ʹͯ͠Α͔ͬͨ͜ͱ • શ෦ Pull Request ͰϨϏϡʔͰ͖Δ • ͋ͱ͔Β༷ʑͳ͜ͱΛৼΓฦΔ͜ͱ͕Ͱ͖Δɻ
͋ͱ͔ΒৼΓฦΔ͜ͱ͕Ͱ͖Δ • ίϛοτͷճͱ͔ • ͲΜͳίϛοτΛ͔ͨ͠ͱ͔ (શ෦ Pull Request ͰݟΕΔ)
None
4ϲ݄Ͱͪΐ͏ͲͽͬͨΓPR 600݅ ࠓ͜ͷத͔Β ಛʹʮۤ͠Μͩͳʔʯͱ͍͏ͱ͜ΖΛ ͔͍ͭ·ΜͰ͝հ
ͦͷ1 HTTPϋϯυϥෆ҆ఆࣄ݅
Hello, ModernHttpClient • աڈͷ։ൃ͔ΒɺHttpWebRequest ͩͱ Android Ͱ ·Εʹ DNS
͕1΄ͲҾ͚ͳ͘ͳΓɺ௨৴Ͱ͖ͳ͘ͳΔ͜ͱ͕Θ͔͍ͬͯͨɻ • 2015ModernHttpClientΛ͏͜ͱܾΊ͍ͯͨɻ • HttpClient ͷҾʹ͢ HttpClientHandler ͱͯ͢͠ NativeMessageHandler Λఏڙͯ͘͠ΕΔɻ • iOS 9 ͷ ATS ରԠͱͯ͠ඞਢͩͬͨɻ
iOS 8 ͔͋ΜΜ… • ModernHttpClient ͷಋೖࣗମΘΓͱ͢ΜͳΓͰ͖ͨɻ • AutomaticDecompression = true
Λࢦఆ͍ͯ͠Δͱ iOS ͰΫϥογϡ͢Δͱ͔͋ͬͨɻ • ͔͠͠ɺࠓ iOS 8 Ͱ HTTP ͕௨Βͳ͘ͳΔݱ͕ൃੜ͢Δ…
CFNetworkHandler…ࠓiOS9͕͔͋Μ… • ModernHttpClientಉ༷ʹɺHttpClientHandlerͱͯ͑͠Δ System.Net.Http.CFNetworkHandler ͕ೖ͍ͬͯͨͷͰ͏ɻ • iOS 8Ͱ҆ఆ͢Δ͕ɺiOS 9 Ͱ
https ͕௨Βͳ͘ͳͬͨɻ • iOS 8 Ҏલ CFNetworkHandlerɺ ͦΕҎ֎Ͱ NativeMessageHandler Λ ༻͢ΔΑ͏ʹ͢Δ͜ͱͰղܾɻ • NSUrlSessionHandler/AndroidClientHandler ͕ඪ४ࡌ͞Ε(Δ|ͨ)Β͍͠ͷͰظɻ J04PS&BSMJFS $'/FUXPSL)BOEMFS J04 /BUJWF.FTTBHF)BOEMFS "OESPJE /BUJWF.FTTBHF)BOEMFS
ͦͷ2 Content Description จࣈԽ͚ࣄ݅ @Android
ࣗಈςετ͠·͠ΐ͏…·͓ͨ·͔͑Galaxy! • Android ͷ UI ςετΛ͢Δ͜ͱʹͳ͍ͬͯͨͷͰɺContent Description Λࢦఆ͍ͯͨ͠ɻ • ຊͷἧ͑ͷͰ
Xamarin Test Cloud Ͱͳ͘ɺ Remote TestKit ͱUIAutomator ͷΈ߹Θͤɻ • ຊޠͷ Content Description Λࢦఆ͍ͯ͠Δͱ Galaxy S6 edge Ͱ͜ͱ͝ͱ͘??????????????ʹจࣈԽ͚ɻ • ݁ہӳޠࢦఆ͠ɺϦϦʔεલʹ͢͜ͱͰղܾɻXTC ͬͯͯʹͳΔ͔ʁ
ͦͦGalaxyͱXamarinͷ૬ੑ͕ѱ͍ • جຊతʹԿ͔͋Δͷ GalaxyɻS4, S5, S6 શ෦Ϡό͍ɻ • Galaxy S4
4.2.1 ͕ಛʹϠό͍ɻଞͷͰಈ͍͍ͯΔίʔυ͕ී௨ʹམͪΔɻ • ͦͯ͜͠ͷͳΜͱUSBσόοάͰ͖ͳ͍ʢʂʣ • ͨͩɺ͍͕ͭ͜མ͍ͪͯΔͷ্࣮ؒҧ͍ͬͯͨͱ͍͏͜ͱ͔Γͩͬͨɻ • ͖ͬͪΓςετ͍ͨ͠Ϛκͳํ1ήοτ͓ͯ͘͠ͱྑ͍͔ɻ
ͦͷ3 ARM64Ͱଈࢮࣄ݅ @Android
64bit ͷ .so ͕͋Δͱ ABI 64bit ͳ͍ͱࢮ͵ • Android൛ͰRealmґଘ͍ͯ͠ΔωΠςΟϒϥΠϒϥϦΛ͍ͬͯͨɻ
• XamarinͰ͍ͬͯͳ͔ͬͨɻωΠςΟϒϥΠϒϥϦࢀর͍ͯ͠ΔͷΈɻ • ͢ΔͱGalaxy S6ͳͲͷARM64Ͱଈࢮ͢Δ • libmonodroid.so͕ͳ͍ͱग़ͨɻΞϓϦࣗମABI͍࣋ͬͯͳ͍͕ɺ Realm ͷωΠςΟϒϥΠϒϥϦͷ .so ͕ల։͞Εͨ͜ͱͰඞཁʹͳͬͯ͠·ͬͨɻ • ΞϓϦଆ64bit ABI Λαϙʔτͤ͞Δ͜ͱͰղܾɻ
ͦͷ4 ऴྃͨͣ͠ͷը໘ͷը૾͕ ͬͯͯϝϞϦෆࣄ݅
͋ͪͪ͜Ͱىͬͨ͜ • ը૾͕ϝϞϦ্ʹͬͯϦʔΫ / OOM • ಛʹ Android ͷ AnimationDrawable
͕͠Ϳͱ͔ͬͨ
ίʔυͷதͰ࡞ͬͨΦϒδΣΫτඞͣղ์ʂ • ϑΟʔϧυʹࢀরΛ࣋ͬͨ ΦϒδΣΫτ ඞͣ Dispose/ࢀর֎͢͠Δ UIButton appendButton; public
override void ViewDidLoad () { base.ViewDidLoad (); appendButton = new UIButton(new CGRect(10,10, 200, 48)); View.AddSubview(appendButton); } protected override void Dispose(bool disposing) { if (disposing) { if (appendButton != null) { appendButton.Dispose(); appendButton = null; } } base.Dispose(disposing); }
iOSͷ߹: Image,Layer ͷதղ์͢Δ • ϓϩϑΝΠϥͰΈͨͱ͖ը૾͕͍ͬͯͨ͜ͱ͕͋Δ • ͦ͏͍͏ͱ͖ ImageView ͷ Image,
Layer.SubLayers ۭʹͯ͠ɺ RemoveFromSuperview ͢Δͱྑ͍ɻ if (HogeImageView != null) { HogeImageView.Image = null; if (HogeImageView.Layer != null) { HogeImageView.Layer.Sublayers = null; } HogeImageView.RemoveFromSuperview(); }
Android: AnimationDrawable ͷ State ղ์ • AnimationDrawable Λͬͨ߹ɺ தͷϑϨʔϜͷBitmap͕ ղ์͞Εͳ͍ͷͰɺ
ࣗͰதΛRecycleͯ͠ SetState Ͱࢀরղ์ͯ͠Δɻ void RecycleAnimationDrawable() { if (_drawableAnimation == null) { return; } for (int i = 0; i < _drawableAnimation.NumberOfFrames; ++i) { var frame = _drawableAnimation.GetFrame(i); var bitmap = frame as BitmapDrawable; if ((bitmap != null) && !bitmap.IsRecycled) { bitmap.Recycle(); bitmap.Dispose(); } frame.Callback = null; } _drawableAnimation.Callback = null; _drawableAnimation.SetState(new int[] { }); _drawableAnimation = null; }
ͦͷ5 MvvmCross ͷ ListViewAdapter Viewੜ࣌ʹແବʹηοτ͕ಈ͘ @Android
MvxListView ͷ MvxAdapter • MvxListView ༻ʹόΠϯσΟϯάՄೳͳ ViewItem Λఏڙ͢Δ Adapter •
ͦͷ··͏͜ͱɺΧελϜͯ͠͏͜ͱͰ͖Δɻ • CreateBindableView ΛΦʔόʔϥΠυ͢Δɻ • ͳ͔ͥ CreateBindableView ͷੜ࣌ʹΫϥογϡͯ͠͠·͏͜ͱ͕͋ͬͨɻ • ߲ View ͷ MvxImageView ͷதͰ SetImageDrawable(null) ͕ಈ͍͍ͯͨɻ
CreateBindableView ൈ͚Δલʹ Binding ߋ৽͞ΕΔͷμϝ protected override IMvxListItemView CreateBindableView(object dataContext, int
templateId) { var itemView = base.CreateBindableView(dataContext, templateId); var view = itemView as View; if (view != null) { var imageView = view.FindViewById<MvxImageView>(Resource.Id.timeline_image); imageView.ErrorImageResourceId = Resource.Drawable.img_live_object_loadfail; } return itemView; } %BUB$POUFYUͷ४උ͕ऴΘͬͯͳ͍λΠϛϯάͰݺΕΔ ˠը૾͕OVMM͕ೖͬͯ͘ΔՄೳੑ͕͋Δ
DataContext ॳظԽऴΘ͔ͬͯΒܨ͙ protected override IMvxListItemView CreateBindableView(object dataContext, int templateId) {
var itemView = base.CreateBindableView(null, templateId); var view = itemView as View; if (view != null) { var imageView = view.FindViewById<MvxImageView>(Resource.Id.timeline_image); imageView.ErrorImageResourceId = Resource.Drawable.img_live_object_loadfail; } itemView.DataContext = dataContext; return itemView; }
ͦͷ6 iOS 8 ͰىಈޙҰൃͷ γϟολʔԻ͕໐Βͳ͍
iOS 8 ͷγϟολʔ໐Βͳ͍όά • ຊࠃ͚ͷ iPhone ͰαΠϨϯτϞʔυʹ͍ͯͯ͠ γϟολʔԻ͕ͳΔ • ͔͠͠ɺiOS
8 Ͱ OS ىಈޙ 1 ճͷγϟολʔԻ͕໐Βͳ͍ɻ • Α͘ΒΕͨ iOS ࣗମͷόά
iOS 8 ͷॳճͷΈɺ ڧ੍తʹγϟολʔԻΛ໐Β͢ (Βͳ͍ํ͕ྑ͍) • iOS ΈࠐΈͷޮՌԻΛ໐Β͢ AudioToolBox.SystemSound •
1108 ൪Λࢦఆ͢ΔͱɺΧϝϥͱಉ݅͡Ͱγϟολʔ͕໐Δ • iOS 8 ͷఆ UIDevice.CurrentDevice.CheckSystemVersion ͰՄೳɻ • ౾ࣝɿ͜ͷϝιου Xamarin ಠ֦ࣗு
iOS 8 ͷॳճͷΈɺ ڧ੍తʹγϟολʔԻΛ໐Β͢ (Βͳ͍ํ͕ྑ͍) needDummyShutterSound = UIDevice.CurrentDevice.CheckSystemVersion(8, 0)
&& !UIDevice.CurrentDevice.CheckSystemVersion(9, 0) && !dummyShutterSoundPlayed; : : if (needDummyShutterSound) { needDummyShutterSound = false; dummyShutterSoundPlayed = true; var sound = new AudioToolbox.SystemSound(1108); sound.PlaySystemSound(); } J04Ҏ্ɺJ04Ҏ্Ͱͳ͍ ͔ͭ·ͩ໐Βͯ͠ͳ͍ TUBUJDϑΟʔϧυ ൪ͷγεςϜαϯυΛ໐Β͢
·ͱΊ
ओͳ·ΓϙΠϯτճආํ๏ • HTTP௨৴पΓ ModernHttpClient (͘͠NSUrlSessionHandler/AndroidSessionHandler)Λ͏ɻ iOS 8 ҎԼ CFNetworkHandler
Λͬͨ΄͏͕Αͦ͞͏ɻ • ࢀরͨ͠ωΠςΟϒΦϒδΣΫτ͖ͪΜͱղ์͢Δɻ ಛʹը૾पΓղ์ʹؾΛ͚ͭΔɻ • Galaxyɺઈର͍ͭ͜Կ͔͋Δɻ1 ͋Δͱσόοάʹศརɻ Xamarin Test Cloud ʹ͍ͬͺ͍͋Γͦ͏͔ͩΒ׆༻͠Α͏ɻ
͍͞͝ʹ