Giter Club home page Giter Club logo

ksscreenshotmanager's Introduction

KSScreenshotManager

Teach your computer to take screenshots of your app so you don't have to anymore. This project simplifies the process of creating automated screenshots of your iOS app. Some assembly is required, as you need to define your screenshots. Once you do that, this code will take care of the rest.

See this blog post for more details: http://ksuther.com/2013/02/24/automating-ios-app-store-screenshots

Adding this to your project

  1. Include KSScreenshotManager in your project. Adding it as a submodule is probably the easiest way to do this. Be sure to check out the ios-sim submodule as well by running git submodule update --init
  2. Add KSScreenshotManager.h, KSScreenshotManager.m, KSScreenshotAction.h, KSScreenshotAction.m to your project
  3. Subclass KSScreenshotManager and override setupScreenshotActions
  4. Copy config.json.example and customize to suit your project

You can also use CocoaPods. You should create a duplicate target in Xcode, so KSScreenshotManager won't be included in your release build. Then, add this to your Podfile:

# Replace 'Screenhots Target' with your separate target name
target 'Screenshots Target', :exclusive => true do
  pod 'KSScreenshotManager'
end

Example project

An example project is located in Example (surprise!). It has a very simple KSScreenshotManager subclass named MyScreenshotManager. You can run it with the following command:

python make_screenshots.py config.json.example

This will compile the sample project then run the simulator build and dump the screenshots to /tmp/screenshots.

This version does not rely on the ios-sim command anymore, instead relying solely on the simctl command bundled with Xcode 6 and later.

Configuration File

The JSON configuration file references the simulators on your system. The names in device_names should match the simulator names as set up in your Xcode devices. Xcode creates default simulators named iPhone 6, iPhone 6s, iPad Air, iPad Air 2, etc.

ios_version is optional if you want screenshots to be created with a particular iOS version. If ios_version is not specified then the latest iOS version found will be used.

You can get a list of the enabled simulators on the command line by running xcrun instruments -s devices and using its output to help your populate these configuration values. Note that connected hardware devices will also show up in this list. Run xcrun simctl list for a list narrowed down to your simulators.

License

MIT License

Copyright (c) 2013 Kent Sutherland

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ksscreenshotmanager's People

Contributors

adamwulf avatar clayallsopp avatar foozmeat avatar glaszig avatar ksuther avatar megastep avatar regularberry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ksscreenshotmanager's Issues

Is it possible to save screens to non-simulator subdirectory?

Failed to write screenshot at ~/Desktop/Screens/iphone480@2x-ru_RU-4-before-last.png: Error Domain=NSCocoaErrorDomain Code=518 "The operation couldn’t be completed. (Cocoa error 518.)" UserInfo=0xa98f3a0 {NSURL=~/Desktop/Screens/iphone480@2x-ru_RU-4-before-last.png}

Build barfs over 'UIGetScreenImage'. Is it just me?

How are you folks getting this to build? My project fails to build due to undefined symbol UIGetScreenImage:

Undefined symbols for architecture x86_64:
  "_UIGetScreenImage", referenced from:
      -[KSScreenshotManager saveScreenshot:includeStatusBar:] in libPods-DangleBerries.a(KSScreenshotManager.o)
ld: symbol(s) not found for architecture x86_64

Am I missing something?

Not able to run example

I am not able to run the example...getting this error:

No matching processes belonging to you were found
Creating screenshots for en using "iPhone Retina (3.5-inch)"...
Traceback (most recent call last):
File "make_screenshots.py", line 100, in
waxsim(app_path, ['-AppleLanguages', '({})'.format(language), '-AppleLocale', language, language_path], device)
File "make_screenshots.py", line 43, in waxsim
subprocess.call(subprocess_args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 493, in call
return Popen(_popenargs, *_kwargs).wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in init
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1228, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

Weird problem setting localized titles in UIBarButtons

I have several view controllers where I set localized titles in viewWillAppear - its a mix of nav bar titles and UIBarButtonItems. If I manually set the simulators language then my buttons appear the way I expect. If I set the language via WaxSim then the buttons are set to the English words. I know that they're being changed in both cases because I'm using dummy text in my storyboard.

Any idea why this would be happening?

Killing the simulator

I'm wondering if this line in make-screenshots.py:

def quit_simulator():
subprocess.call(['killall', 'iPhone Simulator'])

is really meant to be 'iOS Simulator', since that is the name nowadays.

ios 8 on iphone 6 (plus) - scaled apps

i think there's an issue with upscaled apps (at least with mine). screenshots get taken with the "old" 568px dimensions cutting off the right and bottom.

makes sense because old apps don't know anything about auto layout and stuff and are made to think they're running on an these older resolutions/screens.

wonder if there's a way to tell if you're scaled and what the device dimensions are...

related SO:

NSLocale issue

I think it is more relevant to use:

[NSLocale preferredLanguages][0]

instead of:

[[NSLocale currentLocale] localeIdentifier]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.