Automated Screenshots on iOS

49f0cda85134c6aef960bf6a32f4e1c7?s=47 toco
October 02, 2014

Automated Screenshots on iOS

My talk at the Hamburg CocoaHeads on October 2, 2014.
Demo project is here: https://github.com/toco/RealmToDo

49f0cda85134c6aef960bf6a32f4e1c7?s=128

toco

October 02, 2014
Tweet

Transcript

  1. Automated)Screenshots)on)iOS Tobias'Conradi'–'@toco91 CocoaHeads)Hamburg)–)October)2,)2014

  2. Why$automate$capturing$screenshots?

  3. Capturing*screenshots*takes*1me!

  4. Supported)screen)sizes)in)iOS)8 • iPhone(4(320x480@2x • iPhone(5(320x568@2x • iPhone(6(350x667@2x • iPhone(6(Plus(414x736@3x •

    iPad(786x1024@2x
  5. How$many$screenshots? #"sceens"x"#"languages"x"#"devices

  6. iPhone'app 4"screens"x"2"languages"x"4"devices ="32"screenshots

  7. Goal • Easily(automate(screenshot(capture(for(all(supported(devices(and( languages • Screenshots(should(be(ready(for(AppStore(upload • We(will(come(back(later(to(this

  8. How$to$automate$it?

  9. Use$an$exis)ng$solu)on? UIAutoma)on: ,-iOS-Screenshot-Automator-by-Felix-Krause ,-UI-Screen-Shooter-by-Jonathan-Penn Na)ve: ,-KSScreenshotManager-by-Kent-Sutherland Drawbacks: *+Use+of+condi3onal+compila3on *+How+to+replace+content? *+Screenshots+are+not+ready+for+upload

  10. My#solu(on • Na$ve'automa$on'with'ObjC'or'Swi6 • Test'bundle'㱺'no'condi$onal'compila$on • Easy'to'use'custom'content'or'modify'UI'for'screenshots • Not'too'many'new'dependencies •

    No'magic'scripts'modifying'Xcode/Simulator • Screenshots'are'ready'for'upload
  11. Ready&for&upload?

  12. None
  13. None
  14. Always'remove'the'status'bar'from' screenshots'to'present'a'cleaner' look.'iTunes'Connect'expects' screenshots'of'dimensions'that' exclude'that'area. —"iTunes"Connect"Guide"–"Screenshots:"Pictures"Tell"the"App's"Story

  15. iTunes'Connect'Guide'–'Screenshot'Proper4es 4.7$inch)Re,na)screenshot If#your#app#indicates#that#it#is#op2mized#for#the#iPhone#6,#at#least# one#4.7<inch#screenshot#is#required.#[…] Don't&include&the&device&status&bar&in&your&screenshots.# Screenshot#requirements#are: […] 750&x&1334#pixels#for#hi<res#portrait 1334&x&750#pixels#for#hi<res#landscape

  16. 4"Inch'Re*na'Display'Screenshots'(Required) Don't&include&the&device&status&bar&in&your&screenshots.! Screenshot!requirements!are: […] Any!of!the!following!sizes: 640!x!1096!pixels!for!portrait!(without&status&bar)!minimum 640!x!1136!pixels!for!portrait!(full&screen)!maximum 1136!x!600!pixels!for!landscape!(without&status&bar)!minimum 1136!x!640!pixels!for!landscape!(full&screen)&minimum

  17. So#what#now? • iTunes(Connect(doesn't(accept(4.74inch(or(5.54inch(screenshots( without(the(status(bar(region • We(proably(don't(want(do(modify(out(app(to(not(show(the( statusbar • We(don't(want(some(device(screenshots(with(statusbar(and( some(without

    㱺!Let's!hack!the!status!bar!to!be!beau/ful
  18. Steps 1. Automate*naviga/on*through*UI • Automa/on*using*KIF*in*a*test*target • no*condi/onal*compila/on • Might*be*already*used*for*integra/on*tests 2.

    Capture*screens*and*save*them*with*meaningful*name. 3. Change*languages*and*simulated*devices
  19. Demo h"ps:/ /github.com/toco/RealmToDo

  20. Extra&slide:!Demo!content • Add$a$new$test$target$'Screenshots' • Automate$UI$steps$using$KIF • Use$TOCScreenshot$to$take$screenshots • Beau?fy$status$bar$with$SDStatusBarManager$(I#originally#used# XCEDFakeCarrier)

    • Add$schemes$for$different$locales • Add$script$to$run$Screenshot$'tests'$for$all$schemes$and$devices
  21. What%is%good%about%this%solu.on?

  22. Na#ve&language&which&you&already& know&well.

  23. No#hacks#or#strange#dependecies#if# you#use#one#scheme#per#localiza5on. Ok,$exept$for$the$statusbar, $but$you$can$also$take$cropped$screenshots.

  24. Compa&ble*with*Xcode*Bots

  25. What%is%not%so%good%about%this%solu/on? • One%scheme%per%localiza1on • or%a%magic%script/program%to%modify%the%template%scheme.

  26. Any$Ques)ons? @toco91