SlideShare a Scribd company logo
Advanced	
  Titanium	
  iOS	
  


Fred	
  Spencer	
  &	
  Blain	
  Hamon	
  
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
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)
What we’ll cover

•  iOS and Titanium
  lifecycles

•  Titanium memory
  management

•  Custom build options

•  Debugging your apps

•  Titanium ‘export’
iOS and Titanium
   Lifecycles
Application Lifecycle
               App.js
Start
               loads              Standard
                                  Run Loop            pause
                                  (Focused)


               resume
                                      resumed       Standard
                                                    Run Loop
                                                    (Blurred)

     App is
    unloaded            No code
                        running
                                                Background
                                                 JavaScript
                                                runs briefly
Main/UI           Background
iOS & 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
Titanium Memory
   Management
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 ƒ()
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
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
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!
Deep dive @CODESTRONG:



Your Apps are Leaking - Controlling
          Memory Leaks

        Today, 5:20 – 6:00 PM


           Rick Blalock
Common PS Patterns

•  Heavily influenced by product requirements

•  Most Common
   •  Module/Revealing Module, Factory

•  Upcoming
   •  CommonJS ‘require’ modules
Custom Build
  Options
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
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”>
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>
Tip: If your tiapp.xml and custom
Info.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 when
changing between Titanium SDK versions.
Titanium
‘export’
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
Debugging
Your Apps
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
DEMO
Questions?
Resources
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
Resources : Other

•  Memory
   •  appc.me/javascript-memory-management

•  Debugging
   •  appc.me/debugging-mobile-applications

   •  appc.me/apple-debug-gdb

More Related Content

Similar to Fred Spencer & Blain Hamon: Advanced Titanium for iOS

Introduction to React native
Introduction to React nativeIntroduction to React native
Introduction to React nativeDhaval Barot
 
Codestrong 2012 breakout session android internals and best practices
Codestrong 2012 breakout session   android internals and best practicesCodestrong 2012 breakout session   android internals and best practices
Codestrong 2012 breakout session android internals and best practicesAxway Appcelerator
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptAxway Appcelerator
 
SeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisSeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisWill Iverson
 
Никита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CНикита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CDataArt
 
Method Swizzling with Objective-C
Method Swizzling with Objective-CMethod Swizzling with Objective-C
Method Swizzling with Objective-CAdamFallon4
 
Building Mobile Web Apps with jQM and Cordova on Azure
Building Mobile Web Apps with jQM and Cordova on AzureBuilding Mobile Web Apps with jQM and Cordova on Azure
Building Mobile Web Apps with jQM and Cordova on AzureBrian Lyttle
 
Real-world Dojo Mobile
Real-world Dojo MobileReal-world Dojo Mobile
Real-world Dojo MobileAndrew Ferrier
 
Kirin - Making Single Page Web Apps with a Native UI
Kirin - Making Single Page Web Apps with a Native UIKirin - Making Single Page Web Apps with a Native UI
Kirin - Making Single Page Web Apps with a Native UIjhugman
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project Elad Hirsch
 
.NET? MonoDroid Does
.NET? MonoDroid Does.NET? MonoDroid Does
.NET? MonoDroid DoesKevin McMahon
 
Dependency injection
Dependency injectionDependency injection
Dependency injectionhousecor
 

Similar to Fred Spencer & Blain Hamon: Advanced Titanium for iOS (20)

Introduction to React native
Introduction to React nativeIntroduction to React native
Introduction to React native
 
Node.JS briefly introduced
Node.JS briefly introducedNode.JS briefly introduced
Node.JS briefly introduced
 
Codestrong 2012 breakout session android internals and best practices
Codestrong 2012 breakout session   android internals and best practicesCodestrong 2012 breakout session   android internals and best practices
Codestrong 2012 breakout session android internals and best practices
 
Dan Haywood
Dan HaywoodDan Haywood
Dan Haywood
 
Ios development
Ios developmentIos development
Ios development
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScript
 
SeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisSeaJUG May 2012 mybatis
SeaJUG May 2012 mybatis
 
Никита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CНикита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-C
 
Method Swizzling with Objective-C
Method Swizzling with Objective-CMethod Swizzling with Objective-C
Method Swizzling with Objective-C
 
Spring session
Spring sessionSpring session
Spring session
 
Building Mobile Web Apps with jQM and Cordova on Azure
Building Mobile Web Apps with jQM and Cordova on AzureBuilding Mobile Web Apps with jQM and Cordova on Azure
Building Mobile Web Apps with jQM and Cordova on Azure
 
Real-world Dojo Mobile
Real-world Dojo MobileReal-world Dojo Mobile
Real-world Dojo Mobile
 
Kirin - Making Single Page Web Apps with a Native UI
Kirin - Making Single Page Web Apps with a Native UIKirin - Making Single Page Web Apps with a Native UI
Kirin - Making Single Page Web Apps with a Native UI
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
Working and Features of HTML5 and PhoneGap - An Overview
Working and Features of HTML5 and PhoneGap - An OverviewWorking and Features of HTML5 and PhoneGap - An Overview
Working and Features of HTML5 and PhoneGap - An Overview
 
Titanium Alloy Tutorial
Titanium Alloy TutorialTitanium Alloy Tutorial
Titanium Alloy Tutorial
 
Guides To Analyzing WebKit Performance
Guides To Analyzing WebKit PerformanceGuides To Analyzing WebKit Performance
Guides To Analyzing WebKit Performance
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
.NET? MonoDroid Does
.NET? MonoDroid Does.NET? MonoDroid Does
.NET? MonoDroid Does
 
Dependency injection
Dependency injectionDependency injection
Dependency injection
 

More from Axway Appcelerator

Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & RoadmapAxway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & RoadmapAxway Appcelerator
 
2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff HaynieAxway Appcelerator
 
Stop Debating, Start Measuring
Stop Debating, Start MeasuringStop Debating, Start Measuring
Stop Debating, Start MeasuringAxway Appcelerator
 
Mobile & The New Experience Economy (And What it Means for IT)
Mobile & The New Experience Economy  (And What it Means for IT)Mobile & The New Experience Economy  (And What it Means for IT)
Mobile & The New Experience Economy (And What it Means for IT)Axway Appcelerator
 
Apps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really MeansApps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really MeansAxway Appcelerator
 
Appcelerator Presentation Template
Appcelerator Presentation TemplateAppcelerator Presentation Template
Appcelerator Presentation TemplateAxway Appcelerator
 
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote   jonathan rende, appcelerator's vp of productsCodestrong 2012 keynote   jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote jonathan rende, appcelerator's vp of productsAxway Appcelerator
 
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
Codestrong 2012 keynote   jeff haynie, appcelerator's ceoCodestrong 2012 keynote   jeff haynie, appcelerator's ceo
Codestrong 2012 keynote jeff haynie, appcelerator's ceoAxway Appcelerator
 
Codestrong 2012 keynote how to build a top ten app
Codestrong 2012 keynote   how to build a top ten appCodestrong 2012 keynote   how to build a top ten app
Codestrong 2012 keynote how to build a top ten appAxway Appcelerator
 
Codestrong 2012 breakout session at&t api platform and trends
Codestrong 2012 breakout session  at&t api platform and trendsCodestrong 2012 breakout session  at&t api platform and trends
Codestrong 2012 breakout session at&t api platform and trendsAxway Appcelerator
 
Codestrong 2012 breakout session what's new in titanium studio
Codestrong 2012 breakout session   what's new in titanium studioCodestrong 2012 breakout session   what's new in titanium studio
Codestrong 2012 breakout session what's new in titanium studioAxway Appcelerator
 
Codestrong 2012 breakout session using appcelerator cloud services in your ...
Codestrong 2012 breakout session   using appcelerator cloud services in your ...Codestrong 2012 breakout session   using appcelerator cloud services in your ...
Codestrong 2012 breakout session using appcelerator cloud services in your ...Axway Appcelerator
 
Codestrong 2012 breakout session the role of cloud services in your next ge...
Codestrong 2012 breakout session   the role of cloud services in your next ge...Codestrong 2012 breakout session   the role of cloud services in your next ge...
Codestrong 2012 breakout session the role of cloud services in your next ge...Axway Appcelerator
 
Codestrong 2012 breakout session new device platform support for titanium
Codestrong 2012 breakout session   new device platform support for titaniumCodestrong 2012 breakout session   new device platform support for titanium
Codestrong 2012 breakout session new device platform support for titaniumAxway Appcelerator
 
Codestrong 2012 breakout session mobile platform and infrastructure
Codestrong 2012 breakout session   mobile platform and infrastructureCodestrong 2012 breakout session   mobile platform and infrastructure
Codestrong 2012 breakout session mobile platform and infrastructureAxway Appcelerator
 
Codestrong 2012 breakout session making money on appcelerator's marketplace
Codestrong 2012 breakout session   making money on appcelerator's marketplaceCodestrong 2012 breakout session   making money on appcelerator's marketplace
Codestrong 2012 breakout session making money on appcelerator's marketplaceAxway Appcelerator
 
Codestrong 2012 breakout session live multi-platform testing
Codestrong 2012 breakout session   live multi-platform testingCodestrong 2012 breakout session   live multi-platform testing
Codestrong 2012 breakout session live multi-platform testingAxway Appcelerator
 
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
Codestrong 2012 breakout session   leveraging titanium as part of your mobile...Codestrong 2012 breakout session   leveraging titanium as part of your mobile...
Codestrong 2012 breakout session leveraging titanium as part of your mobile...Axway Appcelerator
 
Codestrong 2012 breakout session introduction to mobile web and best practices
Codestrong 2012 breakout session   introduction to mobile web and best practicesCodestrong 2012 breakout session   introduction to mobile web and best practices
Codestrong 2012 breakout session introduction to mobile web and best practicesAxway Appcelerator
 

More from Axway Appcelerator (20)

Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & RoadmapAxway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
 
2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie
 
Making the Mobile Mind Shift
Making the Mobile Mind ShiftMaking the Mobile Mind Shift
Making the Mobile Mind Shift
 
Stop Debating, Start Measuring
Stop Debating, Start MeasuringStop Debating, Start Measuring
Stop Debating, Start Measuring
 
Mobile & The New Experience Economy (And What it Means for IT)
Mobile & The New Experience Economy  (And What it Means for IT)Mobile & The New Experience Economy  (And What it Means for IT)
Mobile & The New Experience Economy (And What it Means for IT)
 
Apps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really MeansApps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really Means
 
Appcelerator Presentation Template
Appcelerator Presentation TemplateAppcelerator Presentation Template
Appcelerator Presentation Template
 
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote   jonathan rende, appcelerator's vp of productsCodestrong 2012 keynote   jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
 
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
Codestrong 2012 keynote   jeff haynie, appcelerator's ceoCodestrong 2012 keynote   jeff haynie, appcelerator's ceo
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
 
Codestrong 2012 keynote how to build a top ten app
Codestrong 2012 keynote   how to build a top ten appCodestrong 2012 keynote   how to build a top ten app
Codestrong 2012 keynote how to build a top ten app
 
Codestrong 2012 breakout session at&t api platform and trends
Codestrong 2012 breakout session  at&t api platform and trendsCodestrong 2012 breakout session  at&t api platform and trends
Codestrong 2012 breakout session at&t api platform and trends
 
Codestrong 2012 breakout session what's new in titanium studio
Codestrong 2012 breakout session   what's new in titanium studioCodestrong 2012 breakout session   what's new in titanium studio
Codestrong 2012 breakout session what's new in titanium studio
 
Codestrong 2012 breakout session using appcelerator cloud services in your ...
Codestrong 2012 breakout session   using appcelerator cloud services in your ...Codestrong 2012 breakout session   using appcelerator cloud services in your ...
Codestrong 2012 breakout session using appcelerator cloud services in your ...
 
Codestrong 2012 breakout session the role of cloud services in your next ge...
Codestrong 2012 breakout session   the role of cloud services in your next ge...Codestrong 2012 breakout session   the role of cloud services in your next ge...
Codestrong 2012 breakout session the role of cloud services in your next ge...
 
Codestrong 2012 breakout session new device platform support for titanium
Codestrong 2012 breakout session   new device platform support for titaniumCodestrong 2012 breakout session   new device platform support for titanium
Codestrong 2012 breakout session new device platform support for titanium
 
Codestrong 2012 breakout session mobile platform and infrastructure
Codestrong 2012 breakout session   mobile platform and infrastructureCodestrong 2012 breakout session   mobile platform and infrastructure
Codestrong 2012 breakout session mobile platform and infrastructure
 
Codestrong 2012 breakout session making money on appcelerator's marketplace
Codestrong 2012 breakout session   making money on appcelerator's marketplaceCodestrong 2012 breakout session   making money on appcelerator's marketplace
Codestrong 2012 breakout session making money on appcelerator's marketplace
 
Codestrong 2012 breakout session live multi-platform testing
Codestrong 2012 breakout session   live multi-platform testingCodestrong 2012 breakout session   live multi-platform testing
Codestrong 2012 breakout session live multi-platform testing
 
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
Codestrong 2012 breakout session   leveraging titanium as part of your mobile...Codestrong 2012 breakout session   leveraging titanium as part of your mobile...
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
 
Codestrong 2012 breakout session introduction to mobile web and best practices
Codestrong 2012 breakout session   introduction to mobile web and best practicesCodestrong 2012 breakout session   introduction to mobile web and best practices
Codestrong 2012 breakout session introduction to mobile web and best practices
 

Recently uploaded

SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...CzechDreamin
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Alison B. Lowndes
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Product School
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIES VE
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backElena Simperl
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Thierry Lestable
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Product School
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...Elena Simperl
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutesconfluent
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsPaul Groth
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationZilliz
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxDavid Michel
 

Recently uploaded (20)

SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 

Fred Spencer & Blain Hamon: Advanced Titanium for iOS

  • 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.js Start 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 Background iOS & 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 custom Info.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 when changing between Titanium SDK versions.
  • 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
  • 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
  • 26.
  • 28. 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
  • 29. Resources : Other •  Memory •  appc.me/javascript-memory-management •  Debugging •  appc.me/debugging-mobile-applications •  appc.me/apple-debug-gdb