SlideShare una empresa de Scribd logo
1 de 38
HOW DO I DO THAT ON
     IPHONE?
      Chris Adamson
      CodeMash 2010
AGENDA


Table tricks

Media mastery

Tsundere tools

Miscellania
TABLE TRICKS
SORTING TABLES WITH KVC
SORTING ARRAYS

NSSortDescriptor works nicely with key-value-coding

Values need to implement compare:

Alternatives

  sortedArrayUsingSelector: - called on value

  sortedArrayUsingFunction:context: - calls a C
  function
CUSTOM TABLE CELLS
CUSTOM TABLE CELLS


Cell goes in its own nib, connected to an outlet in an
owner

Owner uses this outlet when creating new cells

Find subviews of cell by tag, or subclass
UITableViewCell and set up outlets and properties.
TABLE FILTERS
TABLE FILTERING


IB provides “Search Bar and
Search Display Controller”

  UISearchBar and a UITable that
  slides in to show filter results.

  You implement
  UISearchBarDelegate
TOO MUCH MORE!


Tweetie 2 - pull-to-reload

  http://github.com/enormego/
  EGOTableViewPullRefresh

  http://www.drobnik.com/touch/2009/12/how-to-
  make-a-pull-to-reload-tableview-just-like-tweetie-2/

Controls in tables - see Apple’s table guide
MEDIA MASTERY
VIBRATION IS A “SOUND”?
VIBRATION


AudioServicesPlaySystemSound
(kSystemSoundID_Vibrate);

Does nothing on iPod touch

AudioServicesPlayAlertSound with a SystemSoundID
may also vibrate, if user has vibrate-on-ring set
PLAYING NICE WITH IPOD
PLAYING NICE WITH IPOD

Use AVAudioSession categories to set behavior
  AVAudioSessionCategoryAmbient

  AVAudioSessionCategorySoloAmbient

  AVAudioSessionCategoryPlayback

  AVAudioSessionCategoryRecord

  AVAudioSessionCategoryPlayAndRecord

  AVAudioSessionCategoryAudioProcessing
PLAYING NICE WITH IPOD

Core Audio uses same categories, different names
  kAudioSessionCategory_AmbientSound

  kAudioSessionCategory_SoloAmbientSound

  kAudioSessionCategory_MediaPlayback

  kAudioSessionCategory_RecordAudio

  kAudioSessionCategory_PlayAndRecord

  kAudioSessionCategory_AudioProcessing
HANDLING INTERRUPTIONS
HANDLING INTERRUPTIONS

Can be from alarms, incoming calls, etc. If accepted,
your app terminates

AVAudioSessionDelegate beginInterruption,
endInterruption

Core Audio makes you set an interruption callback
when you InitializeAudioSession

App-level is different: applicationWillResignActive: and
applicationWillTerminate:
TSUNDERE TOOLS
“TSUNDERE” (   )
KEYCHAIN
KEYCHAIN ON IPHONE

No access to a system-wide keychain

  Apps get access to their own items only (well…)

Four essential C functions:

  SecItemAdd, SecItemDelete, SecItemUpdate,
  SecItemCopyMatching

All are a huge hassle to call
KEYCHAIN FTW!


Keychain items survive application wipes and
reinstalls

Keychain is encrypted, and backed up by iTunes

Works with untyped void* data types

  You can put whatever you like in a keychain item
KEYCHAIN FTW 2!

Can share data between applications with Keychain

Create Entitlements file with a keychain-access-group
that matches first fragment of your apps’ identifiers.

Use key kSecAttrAccessGroup in keychain calls

Use same signing credentials

  That said… I couldn’t get this working in time
XCODE
BUILDING “LITE” VERSIONS
BUILDING “LITE” VERSIONS

Create multiple targets

Each target has different Info.plist and different build
settings

  Potentially different Icon.png, MainWindow.xib, etc.

Can omit resource files from your lite version

Set OTHER_CFLAGS to do #ifdef
COMMAND-LINE BUILDS
COMMAND-LINE BUILDS

/usr/bin/xcodebuild builds project in current
directory with current settings.

Can build any or all targets, supports different SDKs
(iPhone 2.2 / 3.0 / 3.1), and configurations (Debug /
Release)

Only on Mac

  Buy an XServe for your build farm
CREATING .CAF FILES
/USR/BIN/AFCONVERT


Reads and writes all default Core Audio formats

Useful for converting into .caf format (preferred
format for iPhone audio files) and transcoding (no
floating-point PCM samples on iPhone)

Getting the arguments right can be tough

  afconvert -d LEI16 -f 'caff' orig-cymbal.caf
MISCELLANIA
HOW TO GET YOUR
NETWORK APP REJECTED
NETWORK REACHABILITY


Create SCNetworkReachabilityRef

Call SCNetworkReachabilityGetFlags with address
you intend to connect to

  Call SCNetworkReachabilitySetCallback to get
  callbacks when this value changes

Mask off the results
USEFUL REACHABILITY FLAGS

Good: kSCNetworkReachabilityFlagsReachable,

Probably OK:
kSCNetworkReachabilityFlagsConnectionRequired,
kSCNetworkReachabilityFlagsConnectionOnTraffic,
kSCNetworkReachabilityFlagsConnectionOnDemand

How to know you’re not on wi-fi:
kSCNetworkReachabilityFlagsIsWWAN
MAKE NETWORK FAST

   URL Loading System quietly supports gzip and deflate

     You just get the decoded data

NSMutableURLRequest *request = [NSMutableURLRequest
         requestWithURL:postURL];
[request setHTTPMethod: @"POST"];
[request addValue:@"gzip"
         forHTTPHeaderField:@"Accepts-Encoding"];
MORE…




Prepared exclusively for Chris Adamson
CONTACT

Me:

 http://www.subfurther.com/

 @invalidname

 invalidname@gmail

iPhone SDK Development book

 http://www.pragprog.com/

Más contenido relacionado

Destacado

А эффективен ли сайт?
А эффективен ли сайт?А эффективен ли сайт?
А эффективен ли сайт?Usanov Aleksey
 
CLA Social Presentation 11
CLA Social Presentation 11CLA Social Presentation 11
CLA Social Presentation 11Brian Barela
 
SC Hospital Association Presentation: Health Care Reform - What Does It Mean ...
SC Hospital Association Presentation: Health Care Reform - What Does It Mean ...SC Hospital Association Presentation: Health Care Reform - What Does It Mean ...
SC Hospital Association Presentation: Health Care Reform - What Does It Mean ...Katherine Swartz Hilton
 
Escenario y cultura de la Web social + 10 pistas para medios que quieran cambiar
Escenario y cultura de la Web social + 10 pistas para medios que quieran cambiarEscenario y cultura de la Web social + 10 pistas para medios que quieran cambiar
Escenario y cultura de la Web social + 10 pistas para medios que quieran cambiarJose Luis Orihuela
 
Isolation of genes differentially expressed during the defense response of Ca...
Isolation of genes differentially expressed during the defense response of Ca...Isolation of genes differentially expressed during the defense response of Ca...
Isolation of genes differentially expressed during the defense response of Ca...CIAT
 
Webservices e Computação em Nuvem com PHP
Webservices e Computação em Nuvem com PHPWebservices e Computação em Nuvem com PHP
Webservices e Computação em Nuvem com PHPFlávio Lisboa
 
Departamento De CiêNcias Da EducaçãO
Departamento De CiêNcias Da EducaçãODepartamento De CiêNcias Da EducaçãO
Departamento De CiêNcias Da EducaçãOcatherineee
 
2011 05 dag 2 masterclass opdrachtschouw, sfs, streefbeeld en strategie, scho...
2011 05 dag 2 masterclass opdrachtschouw, sfs, streefbeeld en strategie, scho...2011 05 dag 2 masterclass opdrachtschouw, sfs, streefbeeld en strategie, scho...
2011 05 dag 2 masterclass opdrachtschouw, sfs, streefbeeld en strategie, scho...Stipo
 
Indenização das empresas urbs
Indenização das empresas   urbsIndenização das empresas   urbs
Indenização das empresas urbsProfessora Josete
 
Yahoo Hack Day
Yahoo Hack DayYahoo Hack Day
Yahoo Hack Daye27
 
Gene discovery application_rice
Gene discovery application_riceGene discovery application_rice
Gene discovery application_riceCIAT
 
Pensamentos e reflexões em 2011
Pensamentos e reflexões em 2011Pensamentos e reflexões em 2011
Pensamentos e reflexões em 2011Aclecio Dantas
 
RRT 2010 - MicroEnsure on Microinsurance
RRT 2010 - MicroEnsure on MicroinsuranceRRT 2010 - MicroEnsure on Microinsurance
RRT 2010 - MicroEnsure on MicroinsuranceMABSIV
 
2011 02 megapolisering stipo
2011 02 megapolisering stipo2011 02 megapolisering stipo
2011 02 megapolisering stipoStipo
 

Destacado (20)

Citrix Vision And Strategy Oct 2009
Citrix Vision And Strategy Oct 2009Citrix Vision And Strategy Oct 2009
Citrix Vision And Strategy Oct 2009
 
А эффективен ли сайт?
А эффективен ли сайт?А эффективен ли сайт?
А эффективен ли сайт?
 
CLA Social Presentation 11
CLA Social Presentation 11CLA Social Presentation 11
CLA Social Presentation 11
 
SC Hospital Association Presentation: Health Care Reform - What Does It Mean ...
SC Hospital Association Presentation: Health Care Reform - What Does It Mean ...SC Hospital Association Presentation: Health Care Reform - What Does It Mean ...
SC Hospital Association Presentation: Health Care Reform - What Does It Mean ...
 
Escenario y cultura de la Web social + 10 pistas para medios que quieran cambiar
Escenario y cultura de la Web social + 10 pistas para medios que quieran cambiarEscenario y cultura de la Web social + 10 pistas para medios que quieran cambiar
Escenario y cultura de la Web social + 10 pistas para medios que quieran cambiar
 
Isolation of genes differentially expressed during the defense response of Ca...
Isolation of genes differentially expressed during the defense response of Ca...Isolation of genes differentially expressed during the defense response of Ca...
Isolation of genes differentially expressed during the defense response of Ca...
 
Webservices e Computação em Nuvem com PHP
Webservices e Computação em Nuvem com PHPWebservices e Computação em Nuvem com PHP
Webservices e Computação em Nuvem com PHP
 
Trading stockssemanal10062011
Trading stockssemanal10062011Trading stockssemanal10062011
Trading stockssemanal10062011
 
Departamento De CiêNcias Da EducaçãO
Departamento De CiêNcias Da EducaçãODepartamento De CiêNcias Da EducaçãO
Departamento De CiêNcias Da EducaçãO
 
Southlake Focus Group April LinkedIn Presentation
Southlake Focus Group April LinkedIn PresentationSouthlake Focus Group April LinkedIn Presentation
Southlake Focus Group April LinkedIn Presentation
 
2011 05 dag 2 masterclass opdrachtschouw, sfs, streefbeeld en strategie, scho...
2011 05 dag 2 masterclass opdrachtschouw, sfs, streefbeeld en strategie, scho...2011 05 dag 2 masterclass opdrachtschouw, sfs, streefbeeld en strategie, scho...
2011 05 dag 2 masterclass opdrachtschouw, sfs, streefbeeld en strategie, scho...
 
Indenização das empresas urbs
Indenização das empresas   urbsIndenização das empresas   urbs
Indenização das empresas urbs
 
1
11
1
 
Percorso professionale
Percorso professionalePercorso professionale
Percorso professionale
 
Yahoo Hack Day
Yahoo Hack DayYahoo Hack Day
Yahoo Hack Day
 
Gene discovery application_rice
Gene discovery application_riceGene discovery application_rice
Gene discovery application_rice
 
Test
TestTest
Test
 
Pensamentos e reflexões em 2011
Pensamentos e reflexões em 2011Pensamentos e reflexões em 2011
Pensamentos e reflexões em 2011
 
RRT 2010 - MicroEnsure on Microinsurance
RRT 2010 - MicroEnsure on MicroinsuranceRRT 2010 - MicroEnsure on Microinsurance
RRT 2010 - MicroEnsure on Microinsurance
 
2011 02 megapolisering stipo
2011 02 megapolisering stipo2011 02 megapolisering stipo
2011 02 megapolisering stipo
 

Más de Chris Adamson

Whatever Happened to Visual Novel Anime? (AWA/Youmacon 2018)
Whatever Happened to Visual Novel Anime? (AWA/Youmacon 2018)Whatever Happened to Visual Novel Anime? (AWA/Youmacon 2018)
Whatever Happened to Visual Novel Anime? (AWA/Youmacon 2018)Chris Adamson
 
Whatever Happened to Visual Novel Anime? (JAFAX 2018)
Whatever Happened to Visual Novel Anime? (JAFAX 2018)Whatever Happened to Visual Novel Anime? (JAFAX 2018)
Whatever Happened to Visual Novel Anime? (JAFAX 2018)Chris Adamson
 
Media Frameworks Versus Swift (Swift by Northwest, October 2017)
Media Frameworks Versus Swift (Swift by Northwest, October 2017)Media Frameworks Versus Swift (Swift by Northwest, October 2017)
Media Frameworks Versus Swift (Swift by Northwest, October 2017)Chris Adamson
 
Fall Premieres: Media Frameworks in iOS 11, macOS 10.13, and tvOS 11 (CocoaCo...
Fall Premieres: Media Frameworks in iOS 11, macOS 10.13, and tvOS 11 (CocoaCo...Fall Premieres: Media Frameworks in iOS 11, macOS 10.13, and tvOS 11 (CocoaCo...
Fall Premieres: Media Frameworks in iOS 11, macOS 10.13, and tvOS 11 (CocoaCo...Chris Adamson
 
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is Fine
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is FineCocoaConf Chicago 2017: Media Frameworks and Swift: This Is Fine
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is FineChris Adamson
 
Forward Swift 2017: Media Frameworks and Swift: This Is Fine
Forward Swift 2017: Media Frameworks and Swift: This Is FineForward Swift 2017: Media Frameworks and Swift: This Is Fine
Forward Swift 2017: Media Frameworks and Swift: This Is FineChris Adamson
 
Firebase: Totally Not Parse All Over Again (Unless It Is) (CocoaConf San Jose...
Firebase: Totally Not Parse All Over Again (Unless It Is) (CocoaConf San Jose...Firebase: Totally Not Parse All Over Again (Unless It Is) (CocoaConf San Jose...
Firebase: Totally Not Parse All Over Again (Unless It Is) (CocoaConf San Jose...Chris Adamson
 
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Chris Adamson
 
Firebase: Totally Not Parse All Over Again (Unless It Is)
Firebase: Totally Not Parse All Over Again (Unless It Is)Firebase: Totally Not Parse All Over Again (Unless It Is)
Firebase: Totally Not Parse All Over Again (Unless It Is)Chris Adamson
 
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)Chris Adamson
 
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)Chris Adamson
 
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)Video Killed the Rolex Star (CocoaConf Columbus, July 2015)
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)Chris Adamson
 
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...Chris Adamson
 
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Chris Adamson
 
Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014Chris Adamson
 
Stupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las VegasStupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las VegasChris Adamson
 
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)Chris Adamson
 
Stupid Video Tricks (CocoaConf DC, March 2014)
Stupid Video Tricks (CocoaConf DC, March 2014)Stupid Video Tricks (CocoaConf DC, March 2014)
Stupid Video Tricks (CocoaConf DC, March 2014)Chris Adamson
 
Introduction to the Roku SDK
Introduction to the Roku SDKIntroduction to the Roku SDK
Introduction to the Roku SDKChris Adamson
 

Más de Chris Adamson (20)

Whatever Happened to Visual Novel Anime? (AWA/Youmacon 2018)
Whatever Happened to Visual Novel Anime? (AWA/Youmacon 2018)Whatever Happened to Visual Novel Anime? (AWA/Youmacon 2018)
Whatever Happened to Visual Novel Anime? (AWA/Youmacon 2018)
 
Whatever Happened to Visual Novel Anime? (JAFAX 2018)
Whatever Happened to Visual Novel Anime? (JAFAX 2018)Whatever Happened to Visual Novel Anime? (JAFAX 2018)
Whatever Happened to Visual Novel Anime? (JAFAX 2018)
 
Media Frameworks Versus Swift (Swift by Northwest, October 2017)
Media Frameworks Versus Swift (Swift by Northwest, October 2017)Media Frameworks Versus Swift (Swift by Northwest, October 2017)
Media Frameworks Versus Swift (Swift by Northwest, October 2017)
 
Fall Premieres: Media Frameworks in iOS 11, macOS 10.13, and tvOS 11 (CocoaCo...
Fall Premieres: Media Frameworks in iOS 11, macOS 10.13, and tvOS 11 (CocoaCo...Fall Premieres: Media Frameworks in iOS 11, macOS 10.13, and tvOS 11 (CocoaCo...
Fall Premieres: Media Frameworks in iOS 11, macOS 10.13, and tvOS 11 (CocoaCo...
 
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is Fine
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is FineCocoaConf Chicago 2017: Media Frameworks and Swift: This Is Fine
CocoaConf Chicago 2017: Media Frameworks and Swift: This Is Fine
 
Forward Swift 2017: Media Frameworks and Swift: This Is Fine
Forward Swift 2017: Media Frameworks and Swift: This Is FineForward Swift 2017: Media Frameworks and Swift: This Is Fine
Forward Swift 2017: Media Frameworks and Swift: This Is Fine
 
Firebase: Totally Not Parse All Over Again (Unless It Is) (CocoaConf San Jose...
Firebase: Totally Not Parse All Over Again (Unless It Is) (CocoaConf San Jose...Firebase: Totally Not Parse All Over Again (Unless It Is) (CocoaConf San Jose...
Firebase: Totally Not Parse All Over Again (Unless It Is) (CocoaConf San Jose...
 
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
 
Firebase: Totally Not Parse All Over Again (Unless It Is)
Firebase: Totally Not Parse All Over Again (Unless It Is)Firebase: Totally Not Parse All Over Again (Unless It Is)
Firebase: Totally Not Parse All Over Again (Unless It Is)
 
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
 
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)
Video Killed the Rolex Star (CocoaConf San Jose, November, 2015)
 
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)Video Killed the Rolex Star (CocoaConf Columbus, July 2015)
Video Killed the Rolex Star (CocoaConf Columbus, July 2015)
 
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...
Revenge of the 80s: Cut/Copy/Paste, Undo/Redo, and More Big Hits (CocoaConf C...
 
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
 
Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014Stupid Video Tricks, CocoaConf Seattle 2014
Stupid Video Tricks, CocoaConf Seattle 2014
 
Stupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las VegasStupid Video Tricks, CocoaConf Las Vegas
Stupid Video Tricks, CocoaConf Las Vegas
 
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
 
Stupid Video Tricks (CocoaConf DC, March 2014)
Stupid Video Tricks (CocoaConf DC, March 2014)Stupid Video Tricks (CocoaConf DC, March 2014)
Stupid Video Tricks (CocoaConf DC, March 2014)
 
Stupid Video Tricks
Stupid Video TricksStupid Video Tricks
Stupid Video Tricks
 
Introduction to the Roku SDK
Introduction to the Roku SDKIntroduction to the Roku SDK
Introduction to the Roku SDK
 

Último

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 

Último (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

How Do You Do That On iPhone? [CodeMash 2010]

  • 1. HOW DO I DO THAT ON IPHONE? Chris Adamson CodeMash 2010
  • 5. SORTING ARRAYS NSSortDescriptor works nicely with key-value-coding Values need to implement compare: Alternatives sortedArrayUsingSelector: - called on value sortedArrayUsingFunction:context: - calls a C function
  • 7. CUSTOM TABLE CELLS Cell goes in its own nib, connected to an outlet in an owner Owner uses this outlet when creating new cells Find subviews of cell by tag, or subclass UITableViewCell and set up outlets and properties.
  • 9. TABLE FILTERING IB provides “Search Bar and Search Display Controller” UISearchBar and a UITable that slides in to show filter results. You implement UISearchBarDelegate
  • 10. TOO MUCH MORE! Tweetie 2 - pull-to-reload http://github.com/enormego/ EGOTableViewPullRefresh http://www.drobnik.com/touch/2009/12/how-to- make-a-pull-to-reload-tableview-just-like-tweetie-2/ Controls in tables - see Apple’s table guide
  • 12. VIBRATION IS A “SOUND”?
  • 13. VIBRATION AudioServicesPlaySystemSound (kSystemSoundID_Vibrate); Does nothing on iPod touch AudioServicesPlayAlertSound with a SystemSoundID may also vibrate, if user has vibrate-on-ring set
  • 15. PLAYING NICE WITH IPOD Use AVAudioSession categories to set behavior AVAudioSessionCategoryAmbient AVAudioSessionCategorySoloAmbient AVAudioSessionCategoryPlayback AVAudioSessionCategoryRecord AVAudioSessionCategoryPlayAndRecord AVAudioSessionCategoryAudioProcessing
  • 16. PLAYING NICE WITH IPOD Core Audio uses same categories, different names kAudioSessionCategory_AmbientSound kAudioSessionCategory_SoloAmbientSound kAudioSessionCategory_MediaPlayback kAudioSessionCategory_RecordAudio kAudioSessionCategory_PlayAndRecord kAudioSessionCategory_AudioProcessing
  • 18. HANDLING INTERRUPTIONS Can be from alarms, incoming calls, etc. If accepted, your app terminates AVAudioSessionDelegate beginInterruption, endInterruption Core Audio makes you set an interruption callback when you InitializeAudioSession App-level is different: applicationWillResignActive: and applicationWillTerminate:
  • 22. KEYCHAIN ON IPHONE No access to a system-wide keychain Apps get access to their own items only (well…) Four essential C functions: SecItemAdd, SecItemDelete, SecItemUpdate, SecItemCopyMatching All are a huge hassle to call
  • 23. KEYCHAIN FTW! Keychain items survive application wipes and reinstalls Keychain is encrypted, and backed up by iTunes Works with untyped void* data types You can put whatever you like in a keychain item
  • 24. KEYCHAIN FTW 2! Can share data between applications with Keychain Create Entitlements file with a keychain-access-group that matches first fragment of your apps’ identifiers. Use key kSecAttrAccessGroup in keychain calls Use same signing credentials That said… I couldn’t get this working in time
  • 25. XCODE
  • 27. BUILDING “LITE” VERSIONS Create multiple targets Each target has different Info.plist and different build settings Potentially different Icon.png, MainWindow.xib, etc. Can omit resource files from your lite version Set OTHER_CFLAGS to do #ifdef
  • 29. COMMAND-LINE BUILDS /usr/bin/xcodebuild builds project in current directory with current settings. Can build any or all targets, supports different SDKs (iPhone 2.2 / 3.0 / 3.1), and configurations (Debug / Release) Only on Mac Buy an XServe for your build farm
  • 31. /USR/BIN/AFCONVERT Reads and writes all default Core Audio formats Useful for converting into .caf format (preferred format for iPhone audio files) and transcoding (no floating-point PCM samples on iPhone) Getting the arguments right can be tough afconvert -d LEI16 -f 'caff' orig-cymbal.caf
  • 33. HOW TO GET YOUR NETWORK APP REJECTED
  • 34. NETWORK REACHABILITY Create SCNetworkReachabilityRef Call SCNetworkReachabilityGetFlags with address you intend to connect to Call SCNetworkReachabilitySetCallback to get callbacks when this value changes Mask off the results
  • 35. USEFUL REACHABILITY FLAGS Good: kSCNetworkReachabilityFlagsReachable, Probably OK: kSCNetworkReachabilityFlagsConnectionRequired, kSCNetworkReachabilityFlagsConnectionOnTraffic, kSCNetworkReachabilityFlagsConnectionOnDemand How to know you’re not on wi-fi: kSCNetworkReachabilityFlagsIsWWAN
  • 36. MAKE NETWORK FAST URL Loading System quietly supports gzip and deflate You just get the decoded data NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:postURL]; [request setHTTPMethod: @"POST"]; [request addValue:@"gzip" forHTTPHeaderField:@"Accepts-Encoding"];
  • 38. CONTACT Me: http://www.subfurther.com/ @invalidname invalidname@gmail iPhone SDK Development book http://www.pragprog.com/