COMP 446 / ELEC 446 Mobile Device Applications Scott Cutler Professor in the Practice of Computer Technology Department of Computer Science Department of Electrical and Computer Engineering cutler@rice.edu 10/3/12 Wednesday 2-3:30, DH 1046 Agenda Events of the Week Next week’s assignment and class Multi-thread, MapKit and Persistence Preview Questions on Assignment #4 SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 2 Events of the Week Samsung Asks for New Trial in Apple Case iOS 6 users continue to grapple with Wi-Fi problems Apple rolls out fix for iPhone 5 Wi-Fi network data bug Apple CEO: We are 'extremely sorry' for Maps flap Intel Disputes Reported Otellini Comments About Windows 8 HP CEO Meg Whitman Shares Turnaround Plan Judge puts Galaxy Tab back on market; Samsung sues over iPhone AT&T nabs One X+, One VX, Windows Phone 8X from HTC SSDs: mind-blowing Moore's law case studies Data Is Data Right? The Truth About LTE vs. 3G Samsung retains U.S. smartphone crown, Apple rapidly catching up The smartphone battle has now moved from hardware to services Nest 2.0: Slimmer, sleeker thermostat smarter than ever SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 3 Current Roster Victor Acuna Ryan Artecona Gbenga Badipe Peter Chang Joan Chao SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 4 Current Roster (2) Alex Chiu Heaven Chen Lingo Dai Weibo He Sahil Hingorani SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 5 Current Roster (3) Abdul Nimeri Bill Robertson Frank Salinas Tyler Siegert Austin Witt Matthew Zhao SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 6 COMP 446 Syllabus (updated) Lecture 1 - 8/22/12 - Introduction Lecture 2 - 8/29/12 - Assignment 1 issues and questions from videos Watch before: 3, 4 (demo part) Assignment: #3 – Graphing Universal Calculator Assignment due: Tuesday, 9/18 6:00 am (Monday 30:00) Lecture 4 - 9/12/12 - Assignment 3 issues and questions from videos Watch before: 1, 2 Assignment: #2 – Function Calculator Assignment due: Friday, 9/7 6:00 am (Thursday 30:00) Lecture 3 - 9/05/12 - Assignment 2 issues and questions from videos Watch before: None Assignment: #1 - Calculator Assignment due: Friday, 8/31 6:00 am (Thursday 30:00) Watch before: 4 (post demo), 5, 6 Assignment: Continue with #3 – Graphing Universal Calculator Assignment due: Tuesday, 9/18 6:00 am (Monday 30:00) Lecture 5 - 9/19/12 - Assignment 3 issues and questions from videos Watch before: Watch 7 before class, 8 after class Assignment: #4 – Flickr Top Places Assignment due: Friday, 10/05 6:00 am (Thursday 30:00) SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 7 COMP 446 Syllabus (updated) Lecture 6 - 9/26/12 - Assignment 4 technology preview Watch before: Assignment: 8, 9 very beginning of 10 1: #6 – Flickr Core Data - To be broken into required and optional parts - Optional part required for A+ 2: Final Project Topic (due before next class) Assignment due: Friday, 10/19 6:00 am (Thursday 30:00) Lecture 8 - 10/10/12 - Assignment 6 technology preview and SQL 8, 9 very beginning of 10 (for Assignment 4) #5 – Flickr Map Places Tasks 3, 4 and 8 are optional for extra credit (required for A+) Assignment due: Thursday, 10/11 6:00 am (Wednesday 30:00) (10/12 OK) Lecture 7 - 10/03/12 - Assignment 5 technology preview Watch by 10/3: Assignment: Watch for #5: 10 (after Tab Bar), 11, 12 Assignment: Final Project Proposal Assignment due: Tuesday, 10/16 6:00 am (Monday 30:00) Lecture 9 - 10/17/12 - iOS 6, Server technology Watch for #6: 13, 14 Assignment: iOS 6 app Assignment due: Friday, 10/26 6:00 am (Thursday 30:00) SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 8 COMP 446 Syllabus (updated) Lecture 10 - 10/24/12 - HTML 5, Windows Phone Lecture 11 - 10/31/12 – Android Assignment: Continue working on Final Project Assignment due: Wednesday, 11/28 2:00pm Lecture 14 - 11/21/12 – No class, but continue on final project Assignment: Continue working on Final Project Assignment due: Wednesday, 11/28 2:00pm Lecture 13 - 11/14/12 - Individual meetings on Final Project Watch before: Optional 17, 18 Assignment: Continue working on Final Project Assignment due: Wednesday, 11/28 2:00pm Lecture 12 - 11/7/12- Android vs. iOS vs. Windows Phone group debate Watch before: Optional 15, 16 Assignment: Major Final Project Feature Assignment due: Friday, 11/2 6:00 am (Thursday 30:00) Assignment: Continue working on Final Project Assignment due: Wednesday, 11/28 2:00pm Lecture 15 - 11/28/12 - Final Presentations Assignment: Document Final Project Assignment due: By time assigned for COMP 446 final (there is NO final exam) SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 9 Final Project Timeline New 9/19 9/26 10/03 10/10 10/17 10/24 10/31 11/7 11/14 11/21 11/28 12/5 - #4 10/05 - #5 10/12 - FP Topic 10/10 - #6 10/17 - FP Proposal 10/16 - Major Feature 11/2 - Individual Meetings 11/14 - Final Presentation 11/28 - Documentation due Finals Day SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 10 Deploying to Device Read deployment information at developer.apple.com 4 Steps Load intermediate certificate Request development certificate Send me device id to register Use Xcode to deploy. It will use team provisioning profile If you have problems, we will have a deployment session after class. SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 11 Week 8 Watch CS193p lectures #10 (after Tab Bar), #11 and #12 Email dialog to determine final project before next class Make progress on CS193p Assignment #5 Try and complete before 10/10 class. Due Thursday, 10/11 6:00 am due to centennial, but Friday submission OK. Next week’s lecture – Core Data Preview SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 12 What is coming up in the assignments? Assignment #4 – Flickr Top Places Tab bar controllers TableView controllers ScrollViews Data from the internet Assignment #5 – Fast Flickr Map Multi Threading / Grand Central Dispatch MapKit Deployment and cache aspects optional (Tasks 3, 4 and 8) Assignment #6 – Core Data Flickr UIDocument Core Data Aspects outside of core data version of #5 optional SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 13 Review of Vides 10-12 Many of the slides to follow come directly from the Fall 2011 Stanford CS193p slide deck. Some come from earlier versions of CS193p which I think were a bit clearer than the current deck SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 14 Video 10 – Grand Central Dispatch UI should always be responsive Put time consuming tasks in a separate queue UI must run in main queue GCD – another example of Apple making a difficult task quite easy Linear programming of multiple queues Rich interface with many complexities Most common scenario is quite simple SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 15 Blocks Simplified A set of statements bracketed by { and } similar to a method or if statement, Preceded by carat ^ ^{ UIImage *image = [UIImage imageWithData:imageData]; self.imageView.image = image; self.imageView.frame = CGRectMake(0, 0, image.size.width, image.size.height); self.scrollView.contentSize = image.size; } Method’s local variables stay in scope For the most part, can be treated like an object (typedef) NSArray methods for enumerating with blocks SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 16 Grand Central Dispatch C API, more () Runs different queues in separate threads Easy process Create queue Dispatch queue with block Release queue Must keep UI in main threat Inside above queue, dispatch UI block within separate block. This is all you will need for Assignment #5 SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 17 GCD Memory Management Issues Avoid circular references to self as it will leak memory _ _ weak MyClass *weakSelf = self; Local variables declared in method before blocks still in scope Read only unless tagged with _ _ block _ _ block BOOL stoppedEarly = NO; SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 18 Video 11 – Core Location / MapKit Two major frameworks that often go together Core Location and MapKit MapKit is the heart of assignment #5 Not part of default linking, but very easy to add SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 19 Core Location Basic object is CLLocation @property coordinate altitude horizontalAccuracy / verticalAccuracy timestamp speed course Highly abstracted from backend processing Many automatic callbacks SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 20 MapKit Base Element is MKMapView Complete map in Class Abstracts underlying technologies Can be layered with other information Rich set of annotations SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 21 MKAnnotation Drop Pins and configurable callouts Similar in many ways to UITableViewCell Can use standard MKAnnotationViews or embellish with custom views SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 22 Video 12 – Persistence Multiple forms of persistence Property Lists (such as NSUserDefaults) Archiving Objects Storing things in the file system SQLite Core Data Core Data is at the heart of Assignment #6 and very important Conceptually difficult, but way simplified from previous years. SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 23 iOS File System Each application has its own sandbox for protection Actual binary along with shipped resources in application bundle directory - which is read only Copy prototype documents to documents directory for modification Cache directory for recreatable objects Directory choice important for backup Watch lecture (short) even if not doing extra credit Core Data will use small part of this technology SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 24 Assignment #4 Questions SEC - 10/3/12 COMP 446 / ELEC 446 - Week 7 25