SlideShare una empresa de Scribd logo
1 de 29
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

Más contenido relacionado

Similar a 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 a 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
 

Más de 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
 

Más de 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
 

Último

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 

Último (20)

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 

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