Your SlideShare is downloading. ×
0
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Fred Spencer & Blain Hamon: Advanced Titanium for iOS
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Fred Spencer & Blain Hamon: Advanced Titanium for iOS

3,193

Published on

In this presentation, we discuss taking advantage of native iOS features on Titanium both through code and configuration, as well as how to use Apple's toolchain for iOS development to be more …

In this presentation, we discuss taking advantage of native iOS features on Titanium both through code and configuration, as well as how to use Apple's toolchain for iOS development to be more productive and produce better products.

Some topics that we'll cover include:

Using Apple's toolchain:
- Debugging app internals
- Custom-configuring plists
- Titanium 'export' and switching to xcode

APIs & Titanium:
- iOS-specific tiapp.xml settings
- App lifecycle on iOS
- View lifecycles & layout
- Memory management 'gotchas'

Published in: Technology
1 Comment
4 Likes
Statistics
Notes
  • 'Download disabled by the author.' I just want download this slide. Can you change download option? :) thanks.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
3,193
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
0
Comments
1
Likes
4
Embeds 0
No embeds

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. Advanced  Titanium  iOS  Fred  Spencer  &  Blain  Hamon  
  2. About Blain•  iOS Platform Engineer, Platform Engineering•  Titanium Mobile Core Contributor •  Origin developer •  Memory architecture•  Longtime Objective-C programmer; MacOS and iOS•  Daily Tools: Gity, Instruments, Terminal, TextWrangler, Xcode
  3. About Fred•  Senior Application Architect, Professional Services•  Titanium Mobile Core Contributor•  Digital Media Instructor, RISD Continuing Education•  Lead architect, Late Night with Jimmy Fallon iPhone / Android, NBC iPad; client apps•  Daily Tools: TextMate, Terminal, Xcode, Tower (git)
  4. What we’ll cover•  iOS and Titanium lifecycles•  Titanium memory management•  Custom build options•  Debugging your apps•  Titanium ‘export’
  5. iOS and Titanium Lifecycles
  6. Application Lifecycle App.jsStart loads Standard Run Loop pause (Focused) resume resumed Standard Run Loop (Blurred) App is unloaded No code running Background JavaScript runs briefly
  7. Main/UI BackgroundiOS & Ti Events Thread JS Thread Click•  Event listener callbacks are Focus Click done asynchronously Handler SetLeft fireEvent•  UI runs on main thread, Size fetch and does not wait for JavaScript Focus•  JavaScript runs in a Handler separate background App thread, and may wait on UI Event Handler
  8. Titanium Memory Management
  9. How it works•  JS uses garbage collection, Native uses retain count•  Kroll objects are JS & Native objects bridging the gap Native Objects JavaScript Objects NSObject NSObject JS object NSObject JS object JS object TiProxy KrollObject pair JS object UIView JS Listener KrollCallback JS ƒ()
  10. An object will hang around if…•  …it’s referenced directly•  …it’s a property of another object•  …it’s being intentionally kept by native elements •  i.e. Window is open, PopOver is shown
  11. Circular reference•  The JavaScript engine is unaware of native relationships•  Does not effect functions added with addEventListener Native Objects JavaScript Objects LEAKY Closure OK Closure TiProxy KrollObject pair JS object JS ƒ() JS ƒ() KrollCallback OK Closure TiProxy KrollObject pair JS Listener
  12. Prevent leaks by avoiding…•  Closures that bind to Titanium proxies•  Extending Titanium object prototypes•  Passing references from one closure to another, without keeping track of the reference trail – null the past!
  13. Deep dive @CODESTRONG:Your Apps are Leaking - Controlling Memory Leaks Today, 5:20 – 6:00 PM Rick Blalock
  14. Common PS Patterns•  Heavily influenced by product requirements•  Most Common •  Module/Revealing Module, Factory•  Upcoming •  CommonJS ‘require’ modules
  15. Custom Build Options
  16. tiapp.xml and Info.plist•  Allows customization of project build options•  tiapp.xml => Info.plist mapping, but not everything•  How do you know what’s available? •  [path to Titanium sdk]/tiapp.py •  Search ‘def parse_iphone’•  Custom Info.plist is merged with tiapp.xml, on project build
  17. What to know (tiapp.xml)•  Use the <iphone> tag to separate from generic and android build options•  Orientation options should be broken out by device type, ‘iphone’ or ‘ipad’ <orientations device=“ipad”>•  The platform tag attribute will ensure the correct platform-specific module will be used <module platform=“iphone” version=“1.0”>
  18. What to know (Info.plist)•  Place in your project’s root folder•  Custom fonts use the the UIAppFonts key and array tags, with nested string tags - font files are placed in project’s ‘Resources’ folder <key>UIAppFonts</key>•  Custom URL schemes can be registered to allow for opening of app from other apps and mobile Safari <key>CFBundleURLSchemes</key>
  19. Tip: If your tiapp.xml and customInfo.plist changes aren’t being picked up, dump the contents of the project’s ‘build/iphone’ folder and re-build. You may also need to do this whenchanging between Titanium SDK versions.
  20. Titanium‘export’
  21. What is and why use it?•  Bundles all resources into an exportable Xcode project•  Python script (1.8.0 feature; TiStudio, late 2011) •  [path to Titanium SDK]/iphone/transport.py •  transport.py [path of Titanium project]•  Share and collaborate on projects with those who have not installed the Titanium SDK•  Consistent entry point for GDB debugging•  Per Project-based, Objective-C customization
  22. DebuggingYour Apps
  23. GDB and Titanium Studio Debugging•  Install Firefox/IE (JS)•  More easily debug both high-level JavaScript and low-level internals•  Excellent for effective module development and Titanium Export
  24. DEMO
  25. Questions?
  26. Resources
  27. Resources : Custom Build Options•  appc.me/ti-tiapp-doc•  appc.me/apple-info-plist-doc•  appc.me/apple-info-plist-fonts•  appc.me/apple-config-common-app-behavior•  appc.me/custom-url-schemes•  appc.me/apple-register-file-types
  28. Resources : Other•  Memory •  appc.me/javascript-memory-management•  Debugging •  appc.me/debugging-mobile-applications •  appc.me/apple-debug-gdb

×