Using KSScreenshotManager

Using KSScreenshotManager

Slides from my talk at Ottawa Cocoaheads on March 14, 2013.

43ad46ec99f6df6051e9915ab9e7225c?s=128

Chuck Shnider

June 16, 2013
Tweet

Transcript

  1. KSScreenshotManager Chuck Shnider twi er: @cshnider ∑

  2. It starts small enough…

  3. None
  4. None
  5. None
  6. None
  7. We’re Gonna Need a Bigger Slide…

  8. None
  9. Production Work

  10. Heaven forbid you have to update them later!

  11. KSScreenshotManager wri en by Kent Sutherland from Flexibits twi er:

    @KSuther
  12. @KSuther

  13. h ps://github.com/ksuther/KSScreenshotManager Open-Source

  14. KSScreenshotManager •Make your code generate the screenshots •Fully-Automated •Runnable from

    scripting environments •Sample Python Script included •Uses “WaxSim” to drive the iOS Simulator
  15. Like Test Automation •Not “For Free” •Cheaper to repeat over

    time •Effort scales more slowly than manual screenshots
  16. Modifying Your Code •WARNING Private API Usage! •Make sure none

    of this ships to the AppStore •Conditional Compile and perhaps use a new target
  17. Modifying Your Code •Add KSScreenshotManager and KSScreenshotAction.h / .m to

    your project. #de ne CREATING_SCREENSHOTS
  18. Modifying Your Code •Create a subclass of KSScreenshotManager •Override -(void)setupScreenshotActions;

  19. setupScreenshotActions •Create instances of KSScreenshotAction •block-based API with optional cleanup

    blocks •synch or async, status bar or no [self addScreenshotAction:newAction];
  20. KSScreenshotAction block •Get the app to the correct state •Cheat

    as necessary •Fake Data, Mock Objects, etc. •Private APIs, both app and OS
  21. AppDelegate Changes #if CREATING_SCREENSHOTS dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 *

    NSEC_PER_SEC)); dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ MyScreenshotManager *screenshotManager = [[MyScreenshotManager alloc] init]; [screenshotManager setTableViewController:viewController]; [screenshotManager takeScreenshots]; }); #endif
  22. Demo