Slide 1

Slide 1 text

i O S Ͱ ແ ݶ ό ο Ϋ ά ϥ ΢ ϯ υ Ξ ο ϓ ϩ ʔ υ ʢ ʹ ௅ ઓ ͯ͠ Έ ͨ ࿩ ʣ P o t a t o t i p s # 1 5 2 0 1 5 - 0 3 - 1 2

Slide 2

Slide 2 text

஫ ҙ ʢ ௥ ه ʣ • ࠓճͷൃද͸iPhone/iOS/APNSͳͲʹυΩϡϝϯτʹ ͸هࡌ͞Ε͍ͯͳ͍ϒϥοΫϘοΫεͳ࢓༷ʹ͍ͭͯ ະݕূͷ෦෼͕͋ΔͷͰਖ਼֬Ͱ͸ͳ͍Ͱ͢ • ൃදޙࢦఠ͍͍ͨͩͨͷͰҰ෦मਖ਼͠·ͨ͠

Slide 3

Slide 3 text

@ a i n a m e R u b y / A W S / i O S ࣗ ݾ ঺ հ

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Α ͘ ͋ Δ Ξϧό Ϝ Ξ ϓ Ϧ • ίϝϯτΛ͚ͭͯࣸਅΛΞοϓϩʔυʢ1ճ1ຕʣ • ϐοΧʔͰը૾Λબ୒ͯ͠ΔͱݱΕΔʮˎҰ౓ʹΞο ϓϩʔυग़དྷΔຕ਺͸Nຕ·ͰͰ͢ʯ • ϑΥΞάϥ΢ϯυͰͷΞοϓϩʔυ͕લఏ

Slide 6

Slide 6 text

࡞ Γ ͨ ͍ Ξϧό Ϝ Ξ ϓ Ϧ • ϐοΧʔͰը૾Λࢦఆ͢ΔͱΞοϓϩʔυ͕࢝·Δ • ΞϓϦΛดͯ͡΋όοΫάϥ΢ϯυͰ׬ྃͤ͞Δ • όοΫάϥ΢ϯυͰແݶʹΞοϓϩʔυ

Slide 7

Slide 7 text

՝ ୊ • iOSΞϓϦ͸όοΫάϥ΢ϯυॲཧ͕ωοΫ • 3෼ͷ੍ݶ͕͋Δ • iOS7Ͱ௥Ճ͞ΕͨNSURLSessionͷbackgroundػೳ࢖͑ͦ͏ • ӬଓԽ͞ΕͨJobΩϡʔ͕ඞཁͦ͏ • NSOperationQueueͩͱϝϞϦʹ͔͠σʔλͷΒͳ͍ͷͰ ΞϓϦดͨ͡Βࢮ͵

Slide 8

Slide 8 text

ό ο Ϋ ά ϥ ΢ ϯ υ Ͱ ௨ ৴ • NSURLSessionΛҎԼΛ૊Έ߹Θͤͯ࢖͏ • NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier: • NSURLSession uploadTaskWithRequest:fromFile: • Ҿ਺ʹNSURLͰ౉ͨ͠ϑΝΠϧύεͷϑΝΠϧΛHTTPϦΫΤε τͷBodyʹ٧Ίͯapplication/octet-streamͰPOST • όοΫάϥ΢ϯυͰ΋Ξοϓϩʔυॲཧ͕ܧଓՄೳΒ͠ ͍ɾɾɾʁ

Slide 9

Slide 9 text

Ӭ ଓ Խ J O B Ω ϡ ʔ • EDQueueͱ͍͏ϥΠϒϥϦΛࢀߟʹಠ࣮ࣗ૷ • https://github.com/thisandagain/queue • FMDB+SQLiteͰӬଓԽ • લͷJob͕ऴྃͨ͠Β࣍ͷJobΛऔΓग़࣮ͯ͠ߦ͢Δ

Slide 10

Slide 10 text

࣮ ࡍ ʹ ࢼ ͯ͠ Έ ͨ • ͔֬ʹΞοϓϩʔυग़དྷΔɾɾɾʂ • ͍͢͝ɾɾɾʂ • ΍ͬͨɾɾɾʂ׬੒΍ɾɾɾʂ • ͔͠͠ɺDeploygateܦ༝Ͱ࢖ͬͯ΋Β͏ͱಈ͔ͳ ͍ɾɾɾʂʁʂʁʂʁ

Slide 11

Slide 11 text

໰ ୊ ൃ ੜ • NSURLSessionConfiguration discretionaryͷυΩϡϝϯτΛಡΜͰΈΔ • > When transferring large amounts of data, you are encouraged to set the value of this property to YES. Doing so lets the system schedule those transfers at times that are more optimal for the device. For example, the system might delay transferring large files until the device is plugged in and connected to the network via Wi- Fi. The default value of this property is NO. • ཁ໿: ୺຤͕Lightningέʔϒϧʹܨ͕͍ͬͯͯWi-FiΛར༻͢Δ·Ͱ େ͖ͳϑΝΠϧͷసૹΛ଴ͭ • https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSessionConfiguration_class/ index.html#//apple_ref/occ/instp/NSURLSessionConfiguration/discretionary

Slide 12

Slide 12 text

࠶ ࣮ ૷ • Silent Remote NotificationΛར༻͢Δ • {aps: {content-available:1}}Λ͚ͭΔ • Push௨஌Λड͚औΔͱ30ඵఔ౓όοΫάϥ΢ϯυͰ ॲཧ͕࣮ߦͰ͖Δ • Ξοϓϩʔυ -> Push௨஌-> Ξοϓϩʔυ -> …
 Ͱ͏·͍͘͘ͷͰ͸ɾɾɾʁ

Slide 13

Slide 13 text

Ϋ ϥ Π Ξ ϯ τ α ʔόʔ ը ૾

Slide 14

Slide 14 text

Ϋ ϥ Π Ξ ϯ τ α ʔόʔ P U S H ௨ ஌

Slide 15

Slide 15 text

· ͱ Ί • iOSͰόοΫάϥ΢ϯυॲཧʹ͸੍ݶ͕͋Δ • Background Transfer͸ʢ࢖͍͜ͳ͢ͷʣ೉͍͠ • ҰఆִؒͰSilent Remote NotificationૹΕ͹
 ແݶΞοϓϩʔυ΋Մೳ!!! • ࣮ࡍʹ͸Push௨஌ʹ͸ඇެ։࢓༷ͰϨʔτϦϛοτ ͕͋ΔͷͰແݶͰ͸ͳ͍ͱͷ͜ͱཁݕূʢ௥هʣ