{"id":686,"date":"2012-10-03T12:50:23","date_gmt":"2012-10-03T19:50:23","guid":{"rendered":"http:\/\/blog.latenightsw.com\/?p=686"},"modified":"2012-10-03T17:41:26","modified_gmt":"2012-10-04T00:41:26","slug":"my-first-iphone-app","status":"publish","type":"post","link":"http:\/\/markalldritt.com\/?p=686","title":{"rendered":"My First iPhone App"},"content":{"rendered":"<p>Now that Script Debugger 5 has been released, and most of the fires have been put out, I am turning my attention to new projects.  As part of this I have been doing a lot of reading and experimenting with Android and iOS development.  I realize I&#8217;m late to the party with iOS\/Android development, but Mac OS work has kept my busy.<\/p>\n\n<p>I finally decided to get my feet out of the mud and build something useful.  I chose as my first significant iPhone app a client for the <a href=\"http:\/\/vvtc.bc.ca\">Victoria Virtual Tennis Club<\/a>.  This is a PHP\/MySQL based web site which I developed to help this organization host Tennis matches in the Victoria B.C. area.  <\/p>\n\n<p>Like most desktop developers moving to mobile, I&#8217;m struggling to keep things simple on iOS and adopt the UI idioms users have come to expect and understand.  I&#8217;m sure I&#8217;ll find ways to simply this app after I&#8217;ve had time to play with it.<\/p>\n\n<p>This is a standard master-detail app which lists a calendar of upcoming VVTC events:<\/p>\n\n<p><img src=\"http:\/\/blog.latenightsw.com\/wp-content\/uploads\/2012\/10\/VVTCMaster.jpg\" alt=\"Master Screen\" \/><\/p>\n\n<p>Taping on an event in the master screen takes you to a detail screen where you can see event details, a list of participants and then sign up for the event if you want to.<\/p>\n\n<p><img src=\"http:\/\/blog.latenightsw.com\/wp-content\/uploads\/2012\/10\/VVTCDetail.jpg\" alt=\"Detail Screen\" \/><\/p>\n\n<p>Behind the scenes, this involved adding a simple REST service to the VVTC web site to get the current calendar information, and to request signup.  This data is returned as a JSON structure.<\/p>\n\n<p>I decided to avoid the various iOS REST frameworks I found, and simply roll my own since I only have two URLs (get calendar, request signup).  This decision may haunt me in the future, but for now things are working and I can understand what&#8217;s going on.  The new NSJSONSerialization class worked flawlessly with the data returned by PHP&#8217;s json_encode function.  Dealing with dates was a bit of an issue, but I finally settled on the ISO 6801 date format and that problem was solved.<\/p>\n\n<p>Going forward, I want to add a Month view that mimics Apple&#8217;s Calendar application using the <a href=\"https:\/\/github.com\/klazuka\/Kal\">Kal<\/a> project as an alternative to the list view I currently have.<\/p>\n\n<p>I want to give full credit to the following resources that made this whole exercise possible within the 2 days I gave myself:<\/p>\n\n<ol>\n<li><p><a href=\"http:\/\/www.apeth.net\/matt\/\">Matt Neuburg<\/a>&#8216;s new &#8220;<a href=\"http:\/\/http:\/\/shop.oreilly.com\/product\/0636920023562.do\">Programming iOS 5<\/a>&#8221; book.  This book explained lots of things for me, but most importantly it allowed me to adopt ARC along with a lot of Objective-C 2 features in my iPhone app.  After <strong>many<\/strong> years of doing manual memory management in Script Debugger, it took a lot to let go of the rains and trust this to the compiler.  This exercise has kind of spoiled me for dealing with my old code.<\/p>\n\n<p>I read the first edition of Matt&#8217;s book cover-to-cover a few years ago and that gave me my basic understanding of the iOS SDK.  A lot has changed over the years, and the new version of the book was great at reacquainting me with the iOS SDK.<\/p><\/li>\n<li><p><a href=\"http:\/\/www.informit.com\/authors\/bio.aspx?a=8FF32343-952D-4C6F-BFA6-F4B757655420\">Erica Sadun<\/a>&#8216;s &#8220;<a href=\"http:\/\/www.informit.com\/store\/product.aspx?isbn=0321832078\">The iOS Developer&#8217;s Cookbook<\/a>&#8220;.  Lifting pieces of Erica&#8217;s code out of her examples saved me a bunch of time.<\/p><\/li>\n<li><p>The <a href=\"https:\/\/github.com\/escoz\/QuickDialog\">QuickDialog<\/a> project.  I used this to build all the detail views in my app and it saved me a mountain of time.<\/p><\/li>\n<li><p>There are many web sites offing directories of reusable iOS (and Mac OS) UI components, but I recently found <a href=\"http:\/\/www.cocoacontrols.com\">Cocoa Controls<\/a>.  This site led me to stumble upon QuickDialog and a number of other useful things.<\/p><\/li>\n<\/ol>\n\n<p><strong>UPDATE<\/strong>: I am missing Cocoa Bindings under iOS.  I know that iOS provides Key Value Observing, but Bindings are missing.  How are others dealing with this omission?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now that Script Debugger 5 has been released, and most of the fires have been put out, I am turning my attention to new projects.&#8230;<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"http:\/\/markalldritt.com\/?p=686\">Continue Reading<span class=\"screen-reader-text\">My First iPhone App<\/span><\/a><\/div><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[5,8,28,13],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7AQk-b4","_links":{"self":[{"href":"http:\/\/markalldritt.com\/index.php?rest_route=\/wp\/v2\/posts\/686"}],"collection":[{"href":"http:\/\/markalldritt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/markalldritt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/markalldritt.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/markalldritt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=686"}],"version-history":[{"count":8,"href":"http:\/\/markalldritt.com\/index.php?rest_route=\/wp\/v2\/posts\/686\/revisions"}],"predecessor-version":[{"id":695,"href":"http:\/\/markalldritt.com\/index.php?rest_route=\/wp\/v2\/posts\/686\/revisions\/695"}],"wp:attachment":[{"href":"http:\/\/markalldritt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/markalldritt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=686"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/markalldritt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}