250 likes | 398 Views
Secrets of an iPhone Developer. Brian Robbins Founder, Riptide Games Slides at http://www.dubane.com/cons/ FITC Mobile – September 14, 2009. Today. Programming AudioSession Accelerometer Input Accelerometer Calibration Prevent screen darkening OS 3.0/2.0 compatibility Anti-Hacking
E N D
Secrets of an iPhone Developer Brian Robbins Founder, Riptide Games Slides at http://www.dubane.com/cons/ FITC Mobile – September 14, 2009
Today Brian Robbins - slides available: http://www.dubane.com/cons/ • Programming • AudioSession • Accelerometer Input • Accelerometer Calibration • Prevent screen darkening • OS 3.0/2.0 compatibility • Anti-Hacking • NSZombieEnabled • Xcode 3.2 Errors / Warnings • Xcode 3.2 Static Analyzer • Demo • App Development • Provisioning Profile tips • iTunes Connect • App Submission Tips • Analytics tracking • Score / Networking Tools • iPhone Configuration Utility (iPCU) • Other Useful Tools
Today’s Goal Most useful session you attend Brian Robbins - slides available: http://www.dubane.com/cons/
AudioSession Brian Robbins - slides available: http://www.dubane.com/cons/ • Can use AudioSession APIs • C-based • Or AVAudioSession (SDK 3.0) • Obj-C wrapper into same C calls • Categories: • Ambient – Games, allows background iPod Music Playback and follows ringer switch • SoloAmbient – Same as ambient, but stops iPod Music Playback so use this if you have your own background music • Playback – Use for audio playback apps • Record & PlayAndRecord – For recording and playback
Accelerometer Input Brian Robbins - slides available: http://www.dubane.com/cons/ • Use an adaptive Low-Pass filter, for better response • Full Implementation in the AccelerometerGraph sample application #define FILTERFACTOR 0.1 #define ATTENUATION 3.0 #define MINSTEP 0.02 // Start with the value from a basic low-pass filter basevalue = (newAcceleration * FILTERFACTOR) + (previousValue * (1.0 - FILTERFACTOR)); // Smooth more for small movement to filter out noised = Clamp(ABS(Normalize(basevalue)-Normalize(newAcceleration))/MINSTEP - 1., 0., 1.); // Calculate a proportional factor alpha = (1.-d) * FILTERFACTOR / ATTENUATION + d * FILTERFACTOR; // Use the new factor to offset smoothed values value = newAcceleration * alpha + basevalue * (1. - alpha);
Accelerometer Calibration Brian Robbins - slides available: http://www.dubane.com/cons/ Map to the user’s starting orientation when doing heavy accelerometer control Do this when action starts, and ideally tell the user Sorry (James) no example
Prevent Screen Darkening Brian Robbins - slides available: http://www.dubane.com/cons/ Turn on during gameplay Turn off in menus [UIApplication sharedApplication].idleTimerDisabled = YES;
OS 3.0 / 2.0 compatibility Brian Robbins - slides available: http://www.dubane.com/cons/ • Use OS 3.0 features like MPMusicPicker, without requiring OS 3.0 • Why? OS upgrades on iPod Touch is very low • 4 technical steps • Business rules for behavior
OS 3.0 / 2.0 Compatibility Brian Robbins - slides available: http://www.dubane.com/cons/ • Target > Info > General • Set Framework Linked Library from “Required” to “Weak” • Target > Info > Build • Set Base SDK to latest SDK (ie 3.0) • Target > Info > Build • Set iPhone OS Deployment Target to oldest SDK (ie 2.1) • Check for availability of class before using it • if ([MPMusicPickerController])
Anti-Hacking Brian Robbins - slides available: http://www.dubane.com/cons/ http://thwart-ipa-cracks.blogspot.com/ Very simple detection, can go a lot more complex NSBundle *bundle = [NSBundle mainBundle]; NSDictionary *info = [bundle infoDictionary]; if ([info objectForKey: @"SignerIdentity"] != nil) {/* do something */ } Can also look to see if app is encrypted, check size of info.plist, call home, etc.
NSZombieEnabled Brian Robbins - slides available: http://www.dubane.com/cons/ • Executables > Info > Arguments • NSZombieEnabled value YES • Good for EXC_BAD_ACCESS • BAD for memory!!!
Xcode 3.2 Errors & Warnings Brian Robbins - slides available: http://www.dubane.com/cons/ Use the tabs to see from last build or all builds Can also group by type instead of by class
Xcode 3.2 Static Analyzer Brian Robbins - slides available: http://www.dubane.com/cons/ Uses Open Source Clang analyzer Good for memory references and Obj-C coding compliance Freaking awesome!
Live Demo Brian Robbins - slides available: http://www.dubane.com/cons/
Provisioning Profile Tips Brian Robbins - slides available: http://www.dubane.com/cons/ • Make and use a single “wildcard” App ID • Nothing but a single * • Use that for all development and provisioning profiles • Unless you’re doing in-app purchase or Push Notification • When adding devices or users make a new Provisioning Profile • ie Riptide_Dev_01, Riptide_Dev_02
iTunes Connect Brian Robbins - slides available: http://www.dubane.com/cons/ • Release Date • When submit, set it to whatever, probably 1-2 weeks in the future • The moment you get approval set the release date to today • For Updates, leave release date as is when submit • Setting to future will remove you from store! • Moment approved, set release date to today
iTunes Connect App Submission Brian Robbins - slides available: http://www.dubane.com/cons/ • Taking ~2 weeks for approval • Every time, even if rejected for app description problem! • Plan for keywords, but don’t use competitor names • Don’t put pricing in your app description • Don’t put keywords in your app title
Analytics Tracking Brian Robbins - slides available: http://www.dubane.com/cons/ Simple, cheap (free) and very easy to implement PinchMedia is good Other major one is Flurry Analytics Not something you need to pay for!
Score / Networking Brian Robbins - slides available: http://www.dubane.com/cons/ Good idea, especially for games Use an existing network to borrow traffic/users OpenFeint, ScoreLoop are biggest open ones Plus+ from ngMoCo is picking up steam, but you have to talk to ngMoCo to use it.
iPhone Configuration Utility Brian Robbins - slides available: http://www.dubane.com/cons/ Search for iPhone Configuration Utility on Apple Site (2.1 latest version) Basically the Xcode Organizer without Xcode Much easier for AdHoc users to install and manage apps
Other Useful Tools Brian Robbins - slides available: http://www.dubane.com/cons/ • MajicRank • http://www.majicjungle.com/majicrank.html • AppViz • http://www.ideaswarm.com/ • MobClix for rank tracking • http://www.mobclix.com/appstore/1 • AppShopper for price history • http://appshopper.com/
Recap Brian Robbins - slides available: http://www.dubane.com/cons/ • Programming • AudioSession • Accelerometer Input • Accelerometer Calibration • Prevent screen darkening • OS 3.0/2.0 compatibility • Anti-Hacking • NSZombieEnabled • Xcode 3.2 Errors / Warnings • Xcode 3.2 Static Analyzer • Demo • App Development • Provisioning Profile tips • iTunes Connect • App Submission Tips • Analytics tracking • Score / Networking Tools • iPhone Configuration Utility (iPCU) • Other Useful Tools
Questions? Slides at http://www.dubane.com/cons/ Brian Robbins www.riptidegames.com Twitter: @dubane brian@riptidegames.com