High quality iOS development
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

High quality iOS development

  • 2,149 views
Uploaded on

For QCon 2011 Beijing

For QCon 2011 Beijing

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • WTF is the point of this? Where is the actual content to go with this table of contents?
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
2,149
On Slideshare
2,145
From Embeds
4
Number of Embeds
2

Actions

Shares
Downloads
47
Comments
1
Likes
1

Embeds 4

http://www.linkedin.com 3
https://www.linkedin.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. High Quality iOS Development @robinlu IN-SRC StudioSaturday, April 9, 2011
  • 2. QualitySaturday, April 9, 2011
  • 3. Topics • Memory management • Tools • Crash Reports • TestSaturday, April 9, 2011
  • 4. Memory ManagementSaturday, April 9, 2011
  • 5. Memory Management alloc object +1 -1 copy reference release retain count 0 deallocSaturday, April 9, 2011
  • 6. Ownership Declare ownership Release ownership • create / copy • don’t need anymore • instance variable • dealloc of owner • container • multi-thread • ...Saturday, April 9, 2011
  • 7. Autorelease • give the ownership to autorelease pool • default autorelease pool created by AppKit • life cycle = event cycle • You can create your own autorelease pool • Don’t over use autoreleaseSaturday, April 9, 2011
  • 8. Problems • Memory Leak • Over-releaseSaturday, April 9, 2011
  • 9. Rules You only release or autorelease objects you own • If you own the object by alloc, copy or retain, you have to release or autorelease • If the object is not owned by you, don’t call release or autoreleaseSaturday, April 9, 2011
  • 10. Pitfalls • Implicit Onwership • Circular ReferenceSaturday, April 9, 2011
  • 11. Implicit Ownership • NSTimer • Delayed performance of selector • Thread • IBOutletSaturday, April 9, 2011
  • 12. Circular Reference A A retains B B retains C C retains A C B Break it with weak referencesSaturday, April 9, 2011
  • 13. General Practices • Instance Variables • Local VariablesSaturday, April 9, 2011
  • 14. Instance Variable get ownership in release ownership in init dealloc viewDidUnload viewDidLoad dealloc setter setter deallocSaturday, April 9, 2011
  • 15. Local Variable Always release or autorelease in the same scopeSaturday, April 9, 2011
  • 16. Summary • Ownership • Rules • Pitfalls • PracticesSaturday, April 9, 2011
  • 17. AnalyzeSaturday, April 9, 2011
  • 18. Analyze • Clang Static Analyzer • More powerful than compiler warnings • Bug finder • memory leaks • dead store • logic error • ...Saturday, April 9, 2011
  • 19. Memory LeaksSaturday, April 9, 2011
  • 20. Potential Memory LeakSaturday, April 9, 2011
  • 21. Dead Store Value stored to ‘matchedRange’ during initialization is never readSaturday, April 9, 2011
  • 22. Logic errorSaturday, April 9, 2011
  • 23. Run AnalyzeSaturday, April 9, 2011
  • 24. InstrumentsSaturday, April 9, 2011
  • 25. Instruments • Memory • Performance • ...Saturday, April 9, 2011
  • 26. Memory • Memory Leaks • Abnormal Allocation • Heapshots • Over Release • Zombies • Memory Clean up • VM TrackerSaturday, April 9, 2011
  • 27. Time Profiling • Sampling • Record Mode • Immediate mode • Deferred modeSaturday, April 9, 2011
  • 28. Crash ReportsSaturday, April 9, 2011
  • 29. Crash Reports • What’s crash reports? • Where to get crash reports? • How to read crash reports? • Generate crash reports by 3rd party libSaturday, April 9, 2011
  • 30. Saturday, April 9, 2011
  • 31. Xcode Organizer Get crash reports from devicesSaturday, April 9, 2011
  • 32. Local Directories • Mac OS X: ~/Library/Logs/CrashReporter/ MobileDevice/ <DEVICE_NAME> • Windows XP: C:Documents and Settings <USERNAME>Application DataApple Computer LogsCrashReporterMobileDevice <DEVICE_NAME> • Windows Vista + 7: C:Users<USERNAME> AppDataRoamingApple ComputerLogs CrashReporterMobileDevice<DEVICE_NAME>Saturday, April 9, 2011
  • 33. iTunes Connect Get users’ crash reports after releaseSaturday, April 9, 2011
  • 34. Crash Types • EXC_BAD_ACCESS (SIGBUS or SIGSEGV) • EXC_CRASH (SIGABRT) • Low Memory • 00000020 Exception Codes Type 0x8badf00d Timeout 0xdeadfa11 User Force-QuitSaturday, April 9, 2011
  • 35. Symbols • Keep symbol before each release • Xcode Archive • dSYM file • Read the report • Xcode organizer • atos, symbolicatecrash, symbolizecrashlog • 3rd party tools - SymbolicatorSaturday, April 9, 2011
  • 36. TestSaturday, April 9, 2011
  • 37. Test • Unit Test • Beta Test • Automating UI TestSaturday, April 9, 2011
  • 38. Unit Test • Unit Test Target • How easy to test: M > C > VSaturday, April 9, 2011
  • 39. Automating UI Test • Instruments • Accessibility • JavascriptSaturday, April 9, 2011
  • 40. Beta Test • Ad Hoc • Build suggestion: Ad Hoc and Distribution share the same bundle id but different from Debug buildSaturday, April 9, 2011
  • 41. Ad Hoc Deploy • Deploy via internet • Hockey • TestFlightApp.com • dropboxSaturday, April 9, 2011
  • 42. Crash Report Lib • plcrashreporter • http://code.google.com/p/plcrashreporter/ • can be used in both ad hoc and distribution builds • output as protobuf-encoded messagesSaturday, April 9, 2011
  • 43. Thanks!Saturday, April 9, 2011