Save 37% off PRO during our Black Friday Sale! »

iphone_dev_jp 東京iPhone/Mac勉強会 (@akisutesama)

iphone_dev_jp 東京iPhone/Mac勉強会 (@akisutesama)

1. Unity Asset Serverを導入してみた話
2. Unity Asset Server ✕ Jenkinsな話
3. Unity Cache Serverを使ってみた話
4. CoreAnimationを使ってみた話
5. Blocksで失敗した話
6. NSURLConnectionにまつわる話

9bf923e39671cde83584e3e926296c13?s=128

Kishikawa Katsumi

April 17, 2012
Tweet

Transcript

  1. ͖͛͝ΜΑ͏ Masashi Ono (@akisutesama) 1

  2. ͓લɺ୭Α http://app.famitsu.com/20120402_50616/ 2

  3. 1. Unity Asset ServerΛಋೖͯ͠Έͨ࿩ 2. Unity Asset Server ✕ Jenkinsͳ࿩

    3. Unity Cache ServerΛ࢖ͬͯΈͨ࿩ 4. Core AnimationΛ࢖ͬͯΈͨ࿩ 5. BlocksͰࣦഊͨ͠࿩ 6. NSURLConnectionʹ·ͭΘΔ࿩ 3
  4. 1. Unity Asset ServerΛಋೖͯ͠Έͨ࿩ 2. Unity Asset Server ✕ Jenkinsͳ࿩

    3. Unity Cache ServerΛ࢖ͬͯΈͨ࿩ (PDFࢿྉ͕ͳ͍Αʼʻ) 4. Core AnimationΛ࢖ͬͯΈͨ࿩ 5. BlocksͰࣦഊͨ͠࿩ (ٸᬎ४උͨ͠Αʼʻ) 6. NSURLConnectionʹ·ͭΘΔ࿩ 4
  5. (ͳʹ͕ͰΔ͔ͳ) 5

  6. 6

  7. Unity Asset ServerΛ ಋೖͯ͠Έͨ࿩ 7

  8. Unity Asset Server? • http://unity3d.com/unity/team/assetserver/ • ཁ͢Δʹόʔδϣϯ؅ཧγεςϜ • ࣮͸ͨͩͷPostgresSQLͩͬͨΓ͢Δ 8

  9. Why Unity Asset Server? • ಋೖ͢Δͷ͕ͪΐ͏͔ΜͨΜʢΠϯετʔϥΆͪΆͪʣ • ࢖͏ͷ͕ͪΐ͏͔ΜͨΜʢUnityͱ׬શʹ౷߹͞Εͯ·͢ʣ • ͦͦ͜͜ߴ଎ʹಈ࡞

    9
  10. Ͱ΋͓ߴ͍ΜͰ͠ΐ͏ʁ • ͸͍ • ͓Ұਓ༷̑ສԁͱͳ͓ͬͯΓ·͢ 10

  11. ϚδͰ • ϚδͰ͢ 11

  12. ಈ͍ͯΔͱ͜ΖΛݟͯΈΑ͏ 12

  13. Α͔ͬͨͱ͜Ζ • ͩΕͰ΋௒؆୯ʹ࢖͑·͢ʂͱʹ͔͘௒؆୯ʂ • UnityͷϓϩδΣΫτΛόʔδϣϯ؅ཧ͢Δͱ͖ݻ༗Ͱൃੜ͢Δ τϥϒϧ͕Ұ੾͋Γ·ͤΜʂ 13

  14. ͍͚ͯͳ͍ͱ͜Ζ • ߴ͍ • ߴ͍ • ߴ͍ • ߴ͍ •

    Subversionͱಉ౳ҎԼఔ౓ͷػೳ͔͋͠Γ·ͤΜ 14
  15. ۩ମతʹ͸ʁ • NO branching • NO tagging • NO merging

    (͕͢͞ʹεΫϦϓτϑΝΠϧ͸mergeͰ͖ΔΑ) • NO external tools (Unityͷ֎͔Β৮Δͷ͕େม) • svn diff --xml --summarize? Ͷ͑ΑͦΜͳ΋Μʂ 15
  16. ૺ۰ͨ͠τϥϒϧҰཡ • ϑΝΠϧΛมߋͨ͠ͷʹมߋࠩ෼͕ೝࣝ͞Εͳ͍ • Updateͨ͠ͷʹϩʔΧϧͷϑΝΠϧ͕ߋ৽͞Ε͍ͯͳ͍ • ಉ࣌઀ଓՄೳͳॳظઃఆ਺͕গͳ͍ (̎̌ਓ͙Β͍) ͜ͷઃఆΛ৮Δʹ͸PostgresSQLͷ஌͕ࣝඞਢ •

    History͔Β෮ݩ͠Α͏ͱͨ͠Β෮ݩݩͷσΟϨΫτϦ͕ແ͍ ͱ͔ݴΘΕͯ෮ݩͰ͖ͳͯ͘ࢮ๢۪ͯ͠ஒ۪ஒ۪ஒ۪ஒ۪ஒ 16
  17. ݁࿦ • όʔδϣϯ؅ཧͷशख़౓͕௿͍ਓͰ΋࢖͑Δͷ͕͍͍͘͢͝ • UnityͰόʔδϣϯ؅ཧ͢Δͱ͖ݻ༗ͷτϥϒϧ͸Ұ੾ͳ͍͕ɺ Ұൠతͳόʔδϣϯ؅ཧΛ͍ͯ͠Δͱ͖ʹͳ͍τϥϒϧ͕͋Δ • subversionͱ͔Α͘஌ͬͯΔνʔϜͰͨ͠Βsubversionͷ΄͏͕ • ͜ΕͰ5ສԁ͸ਖ਼௚ߴ͍

    17
  18. 18

  19. Unity Asset Server ✕ Jenkinsͳ ࿩ 19

  20. JenkinsͷઃఆΛຊ๜ॳެ։ʂ • ɾɾɾͩͱࢥ͏ • ͦΕͰ͸Ͳ͏ͧ 20

  21. 21

  22. 22

  23. 23

  24. 24

  25. 25

  26. 26

  27. 27

  28. 28

  29. ·ͱΊ • Asset Server Plugin͸ͨͩͷݟֻ͚౗͠ • ࣮ࡍͷupdate/build͸Unity3d PluginଆͰ࣮ߦ͞ΕΔ • JenkinsΛ࣮ߦ͢ΔϚγϯ͸ϩάΠϯ͞Ε͍ͯΔඞཁ͕͋Δ

    29
  30. 30

  31. Unity Cache ServerΛ ࢖ͬͯΈͨ࿩ 31

  32. ࢿྉ͕ͳ͍Αʼʻ 32

  33. 33

  34. Core AnimationΛ ࢖ͬͯΈͨ࿩ 34

  35. ͜͜Ͱ֗಄Ξϯέʔτ • Core Animation? ஌Βͳ͍Ͷ͐ • CALayerͬͯ΍ͭͳΒ࢖ͬͯΔΑʂؙ֯࡞ΔͷʹศརͩΑͶʂ • Cabin Attendant๖͑

    • android.animation.ObjectAnimator࢖͑΍Apple৴ऀԵ 35
  36. iOS 2.0ͷ͜Ζ͔Β͍Δͷʹ... 36

  37. ͦ͏ • Core Animation͸iOS։ൃͷ࠷ޙͷϑϩϯςΟΞͩʂ 37

  38. Ͱ݁ہԿ΍ͬͨͷ • ͪΐͬͱ͔͍͍ͬ͜Ξχϝʔγϣϯͱ͔࡞Γ·ͨ͠ʼʻ 38

  39. ಈ͍ͯΔͱ͜ΖΛݟͯΈΑ͏ 39

  40. 40

  41. ొ৔ਓ෺ • CALayer • CAAnimation • ࠓճ͸CAKeyframeAnimation • UIView (ͪΐͬͱϋοΫࡁΈ)

    41
  42. AnimationͱAction • Animationͱ͍͏ͷ͸ݟͯͷ௨ΓΞχϝʔγϣϯͷ͜ͱ • Actionͱ͍͏ͷ͸ಛఆͷCALayerͷϓϩύςΟมԽʹରԠͯ͠Կ ͔ॲཧΛى͜͢͜ͱ (ࠓճ͸positionϓϩύςΟ) • CAAnimation ⊂

    CAAction ͷؔ܎ʹͳΓ·͢ 42
  43. ͪΐͬͱϋοΫ͠·͢Α • ࣮͸ͦͷ··Ͱ͸CALayerͷaction͕ػೳ͠·ͤΜ • ͜Ε͸UIView͕CALayerDelegateͱͯ͠ػೳ͠ɺσϑΥϧτͷ actionForLayer:forKey:Λ௵͍ͯ͠ΔͨΊ • ͡Ό্͋ॻ͖࣮૷ͩʔͬͯ΍ͬͨͷ͕ઌ΄Ͳ͓ݟͤͨ͠ίʔυ 43

  44. CAAnimationͰͰ͖Δ͜ͱ • ࡾ࣍ݩతͳΞχϝʔγϣϯ (CGAffineTransform͚ͩͰ͸ͳͯ͘ CATransform3D͕࢖͑Δ) • ΩʔϑϨʔϜΛࡉ͔͘ࢦఆͨ͠Ξχϝʔγϣϯ • λΠϛϯάؔ਺ͷࣗ࡞ (EaseIn,

    EaseOutͷௐ੔) 44
  45. ࢀߟจݙ • Core Animation for Mac OS X and the

    iPhone • ిࢠॻ੶൛͕׬උ͞Ε͍ͯΔͷ͕࣮ʹྑ͍ (PDF, epub) • த਎΋ͳ͔ͳ͔Α͔ͬͨͰ͢ 45
  46. 46

  47. BlocksͰ ࣦഊͨ͠࿩ 47

  48. Կ΍Β͔ͨ͠ͷ • ͪ͜ΒΛ͝ཡ͍ͩ͘͞ 48

  49. ࠓͷΫϥογϡͻͲ͔ͬͨͶ • ͏̽ • ൜ߦݱ৔Λݟʹߦ͜͏ 49

  50. 50

  51. ൜ߦݱ৔ͷղઆ • ཁ͢ΔʹBlocksΛίʔϧόοΫʹͯ͠APIΛݺͼग़͍ͨ͠ͷΑ • Blocks͸௨৴தNSDictionaryʹಥͬࠐΜͰ͓͘ • ௨৴͕ऴΘͬͨΒऔΓग़ͯ͠ݺͼग़͢ɺҎ্ • ɾɾɾ͜ͷऔΓग़ͯ͠ݺͼग़ͨ͠ॠؒʹΫϥογϡ͍ͯ͠Δ 51

  52. Ͳ͏ͯ͜͠͏ͳͬͨ • ͔͍ͭ·ΜͰݴ͏ͱɺࠓճͷέʔεͰ͸BlockΛίϐʔ͠ͳ͚Ε ͹ͳΒͳ͍ͷ͚ͩΕͲɺίϐʔͯ͠ͳͯ͘མͪͨ • BlocksΛҾ਺ͱ͢Δ৔߹ʹ͸ड͚ͨଆͰίϐʔ͢Δඞཁ͕͋Δ • [aBlock copy] ͡Όͳ͍ͱμϝɺ

    [aBlock retain] ͸μϝ • ࢖ͬͨΒ [aBlock release] ͠ͳ͍ͱμϝ 52
  53. ͳΜͰʁ • ࿩ͤ͹௕͘ͳΔɾɾɾ • @splhack ͞Μͷ ΤΩεύʔτiOSϓϩάϥϛϯάΛୡਓग़൛ࣾ Ͱങ͏ͱ͍͍Αʲະঝ୚޿ࠂʳʲεςϚԵʳ 53

  54. ͔͏ͷΊΜͲ͍ • BlocksΛ؁͘ݟͯ͸ͳΒͳ͍ɾɾɾങ͏ͷͩɾɾɾʲεςϚʳ • ͖ͬ͞ͷέʔε΋࣮͸ARC ONͱARC OFFͰڍಈ͕ҧͬͨΓ͠ ·͢ɻࠓͷίʔυ͸ARC OFFͰ͢ •

    Blocksͷϛεʹ·ͭΘΔόά͸σόοάͮ͠Β͍ • Ͳ͏ͯ͠ίϐʔ͕ඞཁͳͷ͔ɺͱ͔ཧղ͓͍ͯͨ͠΄͏͕ྑ͍ 54
  55. 55

  56. NSURLConnectionʹ ·ͭΘΔ࿩ 56

  57. NSURLConnectionͱ੾அ • ࣮͸NSURLConnection͸ReachabilityΛৗ࣌؂ࢹ͍ͯ͠·͢ • 3G΋WiFi΋࢖͑ͳ͘ͳͬͨΒࣗಈతʹ੾அ͠·͢ • WiFiϗοτεϙοτ͕͋ͬͨΒ઀ଓϑΥʔϜΛग़͠·͢ • ɾɾɾͨͿΜ 57

  58. ͦΕͬͯ౰ͨΓલ͡Όͳ͍ʁ • ͱ͜Ζ͕͗ͬͪΐΜʂ • CFNetworkΛ࢖ͬͯࣗ෼ͰTCPճઢΛ։͘ͱ໌ࣔతʹ੾அ͢Δ ͔໌ࣔతʹԿ͔ύέοτΛૹࣦͬͯഊ͠ͳ͍ݶΓి೾͕ͳ͔Ζ ͏͕Կ࣌ؒͰ΋ܨ͕Γͬͺͳ͠ʹͳΓ·͢ 58

  59. ূڌࣸਅ, NSURLConnection 59

  60. ূڌࣸਅ, CocoaAsyncSocket 60

  61. NSURLConnectionDelegate • iOS 5͔ΒυΩϡϝϯτ͕ͳ͍ΜͰ͢ʼʻ • https://twitter.com/#!/sumihiro/status/190605117370793984 • https://twitter.com/#!/sumihiro/status/190605528995594240 • +

    sendAsynchronousRequest:queue:completionHandler: ࢖͑ͱʁ 61
  62. Ͳ͏͢Μͷ • ϔομϑΝΠϧΛಡΜͰ͍ͩ͘͞ʢΩϦο • Foundation/NSURLConnectionDelegate.h 62

  63. ͦͷsendAsynchronousRequest • niwࢯͷௐࠪʹΑΓ୯ʹGCDͰsendSynchronousRequest͍ͯ͠Δ ͚ͩͱ͍͏͜ͱ͕൑໌ • http://blog.niw.at/post/18720917915 63

  64. ͋Εʁͬͯ͜ͱ͸ʁ • ͸͍ɺtimeout͕ࢦఆͰ͖·ͤΜ • http://techracho.bpsinc.jp/baba/2010_01_11/925 64

  65. ௥ܸͷάϥϯυϰΝΠύʔ • NSMutableURLRequestͰHTTPBodyDataΛࢦఆ͢Δͱtimeout͕ 240ඵݻఆʹͳͬͯมߋͰ͖·ͤΜ • http://techracho.bpsinc.jp/baba/2010_01_13/962 65

  66. Ͳ͏͢Μͷ • NSTimerΛճͯ͠cancel͍ͯͩ͘͠͞ʢΩϦο 66

  67. ϚδͰ • ϚδͰ͢ 67

  68. ·ͱΊΔͱ • چདྷܕͷDelegateΛ࢖͏ํ๏͸υΩϡϝϯτʹࡌͬͯͳ͍ • sendAsynchronousRequest͸్தͰΩϟϯηϧͰ͖ͳ͍͠λΠϜ Ξ΢τ΋ࢦఆͰ͖ͳ͍ • چདྷܕΛԿͱ͔۷Γฦͯ͠࢖ͬͯ΋POST͢ΔͱλΠϜΞ΢τͰ ͖ͳ͍ 68

  69. ݁࿦ • ASIHTTPRequest࢖͑ • NSURLConnection͕࢖༻͞Ε͍ͯͨΒ·ͣ࠷ॳʹٙ͑ 69

  70. 70

  71. ͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ 71