Showing posts with label xcode. Show all posts
Showing posts with label xcode. Show all posts

Monday, 4 March 2013

NSConference 5: Day One

This was my first NSConference and I was impressed. Three days of full-on sessions covering everything from deep technical gotchas, through brutally honest experience reports and even across to basic economics lessons. And the people… I’ve never met so many iOS and Mac developers in one room. Everywhere I turned, there was a developer of an app that I’ve used or know about and admire.

Thank you so much to Scotty and the team. Everything (apart from the wi-fi!) went swimmingly!

iOS performance testing

Bill Dudney @bdudney bdudney@me.com

  • Double check performance even when you think you’re doing it right
  • Watchdog gives you lots of time but user expectation is instantaneous
  • You can use more time on suspend… but don’t go outside watchdog times otherwise app will have to start from scratch
  • Use Time Profiler to check CPU usage on startup
  • VM tracker tells you how much memory is dirty - most crashes come from here
    • Allocations can be low but dirty memory still high
    • e.g. Image allocations
    • Memory gets dirty as soon as you write to it
  • ARC deals with most of issues for you but won’t deal with cycles
    • Can see in leaks
    • Deal with by using weak references
  • Graphics
    • Quartz all happens on CPU
    • OpenGL happens on GPU
    • Separate processor - more power
    • CoreAnimation gives you access without writing raw OpenGL
    • It’s a compositing engine
  • Offscreen rendering can take up lots of time
    • Check offscreen rendering highlight in instruments

searching for speedy searching

Simon Wolf @sgaw or @sw on ADN

  • WWDC 2010 mastering CoreData suggests title contains[dc] $content
  • Can use beginswith to improve speed
  • Even faster use >= 'frog' and < 'froh'
  • But doesn’t work for in-word searching
  • SQLite with full text search FTS (or FTS3, older)
  • Have to build own version of SQLite and include in your app
  • And then can’t use with CoreData
  • Use FMDatabase & FMDatabaseQueue to behave better with threads
  • Use SQLite with FTS to create an index that refers to the Managed Object ID
  • otsNormalizeString string category to remove diacritics (in blog post)
  • FTS search is word based, * is wildcard
  • Can also define “nearness” of terms
  • Need to keep index in sync with CoreData

The ultimate developer toolchain

Richard Morton @richardmorton

  • “if you have a machine and don’t buy it, you will ultimately find you have paid for a machine and don’t have it” — Henry Ford
    • buy a decent developer machine!
  • iOS Support Matrix gives you a good way to find which test devices you need
  • Injection for Xcode: restores “Fix & Continue”
    • uses bundles & method swizzling
  • Xcoverage
    • LLVM provides build coverage
    • instrument program flow & generate test coverage files
  • Mogenerator
  • AppCode by JetBrains
    • would still do bulk of dev in Xcode but boot up AppCode to use refactoring & other unique features
  • Jenkins
  • PaintCode
  • xScope
  • ResourceHelper
    • extra QA for assets

Why making 12 Games in 12 months is a good idea

Matthijs Hollemans @mhollemans

  • lots of game jams around
  • why?
  • experimentation & innovation
  • learning how to finish
    • often there’s a long hard grind to finish
  • learn to limit your scope
    • one single thing
    • take idea and strip it to the core
  • putting constraints on what you’re doing enhances your creativity
  • also get experience in failing to finish games
    • good to find a way to fail faster!

UISS - UIAppearance on Steroids

Robert Wijas @robertwijas

  • UISS available on github & CocoaPods
  • UIAppearance & UIAppearanceContainer lets you set appearance defaults application-wide
  • but need lots of code to do anything…
  • UISS uses JSON syntax, similar to CSS
  • lets you set styles for inner elements
  • and also styles per device type (iPhone/iPad)
  • lets you define variables
  • easily disable bits by prefixing selector with “-“
  • setup:
    • [UISSS configureWithDefaultJSONFile];
    • add uiss.json file
  • debug: UISS status bar
    • tapping status bar shows errors in uiss.json
  • works with live updates in uiss :-)
    • just make uiss.json available via HTTP
    • [UISS configureWithURL:url]
    • let’s you build the app and give it to your designer to adjust, even without Xcode
    • debug option lets you adjust URL
  • generates UIAppearance code for you
    • you’ll want to do that before you create production code
  • can use UIProxy to control your own custom views with UIAppearance
    • also allows you to adjust them with UISS
  • other systems doing same thing:
    • NUI
    • pixate
    • both use traditional CSS - so heavier dependencies

Becoming a product company

Daniel Pasco @dlpasco daniel@blackpixel.com

  • started in 2007 as contracting but aimed from the beginning to be a product company
  • 6 people for 3 years, then doubled in size for 3 years
  • operate as a remote company, HQ in Seattle, but spread over US, with a couple in France
  • have shipped hundreds of apps, but all for other people
    • have a reputation for confidentiality
    • so can’t tell anyone about them…
  • there’s an opportunity cost to do product development
    • in the presence of lucrative contracts, you take a risk and turn away money
  • however, you get stability
    • find that contract work is busy Feb to July
    • occasional spike in November preparing apps for Xmas
  • did client work until they had enough money
    • then did some product work until money ran out
    • then swapped back to contract
    • big gaps between product dev
    • when went back to code, there were lots of changes to make with all the new knowledge…
  • initial product was Bistromath
    • massively over-engineered…
    • developed in a vacuum
  • need to share app with people who know nothing about how the app works
    • tester should not share any of your assumptions
  • life after being featured…
    • intense — but treat it as a bonus
    • people need to be aware of the app outside of the app store
  • painful first product experience made them very gunshy
  • learnings:
    • vet your ideas early on
    • get feedback on betas
    • no excitement? that’s an issue
    • if someone wants to extrapolate — that’s great! but leave those additional features for later
    • have a sustainable dev plan — through to the product release
    • check out marketing
  • changed business model:
    • grew contracting team so could subsidise continuous product team
    • could keep momentum going
  • got the chance to acquire three products from other developers (NetNewsWire, Kaleidoscope, Versions)
    • existing userbase
    • well-known brands
  • products acquired through revenue-share
    • no money up front
    • revenue share decreases as time goes on
  • wanted to share info & blog monthly, but…
    • have competitors: don’t want to reveal feature roadmap
    • no one knows if you miss a deadline: would have announced and missed three times!
    • no one knows if you drop a feature you promised
  • Apple will not let you transfer an app between accounts
    • unless you get the keys to the old account, customers will have to buy the app over again…
    • trying out introductory pricing on upgrades to help people recover their losses
  • iCloud sync issues with NetNewsWire
    • iCloud/Core Data: still unusable…
      • opening the iCloud container can take up to 25 minutes
    • iCloud/Key Value Store: works fine
    • iCloud/Ubiquitous Documents: has issues
  • got creative tensions from people caring so much about their own products
  • changed aim to be frequent, shorter, release cycles
  • got lost with features — endless ticket list
    • @jury drew a line in the sand: ship by this date
    • focus accordingly
    • the plan:
      • 4 weeks for feature complete
      • then 4 weeks for no P3 bugs (fix or defer)
      • then 2 weeks for no P2s
      • then 1 week for no P1 bugs
    • there will always be another release
      • if that isn’t built into your plan — change your plan!
    • it’s ok to ship with bugs, as long as they’re not blockers

Software Architecture: what questions to ask?

Jacob Gorban @apparentsoft

A short list of questions to ask when adding a new feature to your project:

  • good ideas are insidious: they increase scope
    • must definitely be worth adding…
    • here are some questions to think about before adding a new one to your project
  • is it really a good idea?
    • is it good for your business?
    • it it good for your app in the long run
  • is it DRY?
  • is it orthogonal?
    • good to have smaller pieces joined than one big piece
  • is it testable?
  • is there another way?
    • when you see a good move, look for a better one — Emanuel Lasker
  • what is the cost of changing this later?
  • what would the architecture look like if I didn’t have this problem?
    • is this problem framed properly for my app?
    • perhaps we can change the problem…
  • document the rationale
    • not just for later — helps you understand the problem
    • could also discuss with others
  • what are the facts and assumptions?

Download from http://bit.ly/software_architecture_tips_pdf

WebKit UI Inspector Tips and Tricks

Daniel Jalkut, Red Sweater Software @danielpunkass

  • use webkit inspector to fix a page for printing
  • prototype app store previews
  • can set inspector on in your own (Mac) app:
    • just add -WebkitDeveloperExtras YES argument
    • can add same preference on other apps
    • defaults write <bundle-id> WebkitDeveloperExtras -bool YES
    • or globally: defaults write -g WebkitDeveloperExtras -bool YES
  • Dictionary app uses a WebView… so you can inspect it!
  • preference key doesn’t guarantee that the “Inspect Element” menu item will be available
  • Mail.app is a very good robust HTML editor using a WebView but it overrides the contextual menu
  • for any process (even one that has custom contextual menu):
    • attach to target
    • break on [NSView menuForEvent:]
      • lldb: break set -r menuForEvent
    • ctrl-click in the suspected WebView
    • run code: [[[$rdi _webView] inspector] show:0];
      • event target is in $rdi
  • iOS webkit inspector can inspect Safari or any UIWebView in an app that you own

The Invisible Interface — Adding offline speech UI to your app

Halle Winkler @politepix http://politepix.com

  • large vocabulary tasks
    • use server-based speech recognition
    • UITextView, Nuance, AT&T, iSpeech
  • command and control
    • can use offline speech recognition
    • e.g. OpenEars
  • speech API dimension is time
    • make time, rather than just take time
  • small steps through decision tree, means small steps backwards
    • trust & quickly verify
    • switch between small vocabularies
  • watch out for “out of vocabulary”
    • what happens when people walk past talking loudly…?
    • it’s a solved problem in speech recognition, but deciding what to do is a design issue

Thursday, 8 September 2011

iOSDev UK: Adapting Content for Apps

Dave Addey & Alyson Fielding, Agant Ltd, @daveaddey & @alysonf

  • Why an app?
    • Can you do something with it in dead time?
    • It’s always there when you need it
    • Would you use it yourself?
  • Preparing content
    • content definition lets you split up content into small pieces
  • iPhone vs iPad
    • use cases are different
    • e.g. full page illustrations just don’t work on an iPhone — universal app just doesn’t show them
  • network content:
    • assume no network and make as many things possible as you can
    • then download & cache what you need when network becomes available
    • same goes for submitting stuff — add it to a queue and submit it when a network becomes available
    • e.g. QI app submit a fact
    • provide the app bundle with some initial content to get started
    • if you have information always show it — but show how old it is

content formats

  • HTML
  • Property list
  • Custom XML
  • NSAttributedString
  • Core Data store
  • SQLite database
  • bundled media files
  • text files — e.g. QI facts to rate
  • PDF
  • e.g. QI app
    • books came as ePub (HTML)
    • needed tidying, but was very useful
    • errors could be spotted & fixed directly
    • however, not the right format to put in the app
    • used script to transfer into NSAttributedString
    • better presentation
    • better layout for images & text
    • better pagination
    • content definition really helped
  • e.g. Malcolm Tucker
    • email views driven from plist
    • Aly edited directly in XCode and rebuild to check
    • email content in HTML
    • attachments in PDF
  • e.g. Arsenal app
    • already had a CMS for the website
    • beginning of project — defined an API
    • tweaked the API throughout development, but had something to work from right at the beginning

Helping content experts

  • work hand in hand with them from the beginning
  • make sure they have a real device that they’re using every day
  • try to let the content expert able to make their own build of the app as they change the content
    • anyone working on the content has XCode installed and knows how to build it
    • they also have access to check stuff back in
  • let them play with your toys — it’s fun!
  • put the content in with the development

stats

  • 2.7 million stations are picked from UK Trains picker every month (~88k per day)

Q&A

  • testing
    • looking to do more
    • UI testing is a bit of a faff, but is possible

Wednesday, 7 September 2011

iOSDev UK: Beyond NSLog

Tim Isted, @timisted

NSLog, XCode and gdb

  • useful macros for logging:
    • __FILE__ (full path)
    • __LINE__
    • __FUNCTION__ (and __PRETTY_FUNCTION__)
  • NSStringFromSelector(_cmd) gives you current message
    • Lots of these useful NSString functions, e.g. NSStringFromCGRect
  • use macros in log define
    • non-debug version should be something like: TILog(...) do {} while (0)
  • XCode preferences > Behaviours
    • Run starts — can choose what displays
  • XCode also has a variables view, hidden in the next pane of the debugger
  • add breakpoints for exceptions or non-source code by using little plus button at bottom of breakpoints pane
  • breakpoints have really useful options
    • log to console on hit (with auto hit count)
    • continue automatically
    • only do stuff on conditions
  • gdb commands:
    • s = step = Step In
    • m = Step Over
    • c = Continue
    • p = Print
    • po = Print Object
  • debugging Core Data: use [self valueForKey:@"propertyName"]
  • can use addresses instead of variable names in po
  • can make breakpoints user-specific instead of project-specific

Instruments

  • Time Profiler — great for catching infinite loops!
    • shows you time spent at certain places in call stack
    • tick the “Show Obj-C Only” checkbox
    • look for purple user symbols!
  • Heap Shot tool find leaks
  • quite a few WWDC videos on Instruments

Thursday, 12 November 2009

Apple iPhone Tech Talk London 2009: Overview

Apparently I can blog about this year’s Apple iPhone Tech Talk World Tour, so here’s my notes.

This was a much larger event than last year — and I wasn’t the only person surprised by how many developers turned up. Since the registration process involved entering an iTunes URL, most of the people present must have written an app and got it into the store. However, the gender balance was even worse some recent developer events I’ve attended — it looked like there were more women on the Apple team than in the whole audience…

The kickoff session was a quick rundown of where iPhone development has got to since it launched only 15 months ago (seems like longer, possibly because the jailbreakers got there a fair amount earlier…), and the rest of the day was spent going into details (I'll cover the sessions I attended in later posts). I really hope the Apple guys put their presentations up soon, as there was a lot of great detail that I couldn’t type fast enough to get down :-)

stats

  • only 15 months since App Store launched (though an extra year of iPhone)
    • 2 Billion apps, means 180,000 apps an hour…
    • 100,000 apps in app store
  • more than 50 million devices
  • 81 countries
  • 125,000 registered developers
    • so at least 25,000 who paid money but haven’t put anything in the store yet!

timeline

  • jun 08: seeding SDK & emulator to all devs
  • jul 08: app store live
  • sep 08: customer reviews only by purchasers & versions
  • oct 08: crash reporter & logs
  • mar 09: developer discussion forum (still beta), more customer service agents
  • jun 09: quick reference guides
  • jul 09: news & announcements + better developer support
  • sep 09: new app store categories (genius, essentials), top grossing lists, app store resource centre
  • oct 09: in-app purchase available to free apps

the best apps are…

  • simple or sophisticated (hiding complexity)
  • lightweight
  • intuitive
  • small pieces loosely joined

iPhone users have changed

  • not necessarily technically savvy
  • bringing technology into new places

specific examples of innovative apps

  • each app has 5-7 seconds to sell itself to the user
    • it helps to have a memorable aspect
  • use the latest technologies
  • go the extra mile
  • keep it fresh

  • urbanspoon

    • shake to randomly choose a restaurant in the style of a fruit machine
  • peaks
    • Augmented Reality (AR) for mountains
  • car finder
    • AR for finding car
  • zipcar
    • book and find cars
    • unlock the car over network, when you’re close to it
  • snaptell
    • picture identification
  • postage ~ postcards
    • take a picture and send an electronic postcard
    • can apply simple visual effects
    • visually interesting error messages (look like envelopes with postmarks)
  • timetuner
    • bedside radio
    • location aware — will take timezone into account
    • can set up custom alerts — different radio stations on different days
    • simple sleep timer on main screen
  • weightbot
    • way over the top UI polish…
    • real sounds
    • makes it fun to enter your weight
  • tweetie 2
    • only presents UI when you need it
    • swipe down to refresh at top
    • swipe across a tweet to see options
  • guitartoolkit
    • swipe across to play strings for a selected chord
    • has tuner
    • has metronome that keeps playing when screen goes dark
    • can do this by setting app type — determines what happens when
  • 1112
    • exploration game with lots of extra touches
  • ocarina
    • with worldwide
    • and sonic lighter — added messages for choice of flame to mean something
  • roambi
    • data interaction with data from SAP, Salesforce etc.
    • lots of visual interaction with data
    • pull through folders, seeing preview of front one
    • pie chart can swivel round to see details of the one on the bottom
    • charts can
  • things
    • auto synchronized when iPhone comes into same WiFi network
  • MLB.com At Bat
  • Flick Fishing
    • using GameKit to hook up to other iPhones
  • myStarbucks
    • can send your standard order to someone else so they can order for you
    • (not currently available in UK store)
  • ramp champ
    • in-app purchases
    • shows preview, details and price
    • very good catalogue implementation
  • iceberg reader
    • iTunes puts up a confirmation dialog of purchase as well
    • shows progress of download in-app
    • (again, not yet available in the UK store — though individual books are)

Apple iPhone Tech Talk London 2009: Testing and Debugging Your iPhone Application

Just before this session, I had an interesting discussion with Mike Llewellyn, author of Broadersheet, about unit testing. He uses defensive code with asserts and logging and doesn't think there is enough value in unit testing for mostly UI code.

However, Apple have converted to using unit tests and are making it easy for XCode developers to take advantage of them.

At Kizoom, we’ve used unit tests to test our controller code — ensuring that given a particular input, it goes to the right result view with the appropriate model. This is made easier by using three20 — the result view is identified by a string rather than an object (though using OCMock would let you assert about objects too).

Here’s what Michael Jurewitz jurewitz@apple.com — App Frameworks & Dev Tools Evangelist had to say:

  • thousands of tests in Core Data
    • roughly 90% coverage (that’s very impressive — it’s hard to maintain more than 80%)
    • fully test driven from the start
  • similarly large amount of tests in WebKit
  • Application tests get injected into application and can drive running app

static analysis

  • has found and fixed thousands of bugs in Snow Leopard & iPhone OS :-)
  • use it to learn and enforce good Cocoa practices
  • detects dead stores: unused variables
  • see “Run Static Analyzer” in Project properties / Build
    • might not want to have this for all configurations
    • gets picked up by xcodebuild on the command line

organizer

  • check the console if you get a crash
  • can download app’s data from actual device:
    • check Applications under Summary — your app will have a disclosure arrow

beta testing

  • create a distribution certificate in the iPhone portal
  • create an adhoc provisioning profile
    • can still use a wildcard identifier
  • load it up into XCode
  • make a beta testing config
    • duplicate the release config
    • set Code Signing Entitlements to Entitlements.plist (a new file)
    • use appropriate provisioning profile
    • create new Entitlements: set get-task-allow to false
    • disallows debugging
    • if you want people to debug, then send them a debug build…
  • build + send zip of build + provisioning profile to beta testers
  • they can unzip & drag both to iTunes

crashes

  • can get crash log from user — iTunes syncs them
    • Mac & Windows store them in different places, but can find…
    • also available in iTunes Connect
  • can get Organizer to symbolicate crash log for you
    • your .app and .dSym must be locatable by Spotlight — so keep them

low memory logs

  • see count of pages: each page is 4Kb
  • SpringBoard shares memory with your app — it handles presentation on screen
  • mediaserverd is iPod
  • if you find that something other than your app or SpringBoard is the largest memory user, then file a bug…

other crashes

EXC_CRASH (SIGABRT)

  • 0xdeadfa11 — termination due to too much memory
  • 0x8badf00d — watchdog timeout

EXC_BAD_ACCESS (SIGBUS)

  • objc_msgSend — happens when you message a deallocated object

instruments

  • Zombies template — record reference counts & enabled NSZombie detection
    • see extended detail view using rectangle icon at bottom of window
    • shows stack trace for each event
    • can jump through to code view, then jump into XCode editor