Skip to content

Commit

Permalink
No longer using UIGetScreenImage. Can now compile 64-bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuther committed Jul 8, 2015
1 parent 940dd05 commit daf3059
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions KSScreenshotManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#import "KSScreenshotManager.h"
#import "KSScreenshotAction.h"

CGImageRef UIGetScreenImage(); //private API for getting an image of the entire screen

@interface KSScreenshotManager ()
@property(nonatomic, strong) NSMutableArray *screenshotActions;
@end
Expand Down Expand Up @@ -124,7 +122,14 @@ - (void)saveScreenshot:(NSString *)name includeStatusBar:(BOOL)includeStatusBar
//Get image with status bar cropped out
BOOL isRetina = [[UIScreen mainScreen] scale] != 1.0f;
CGFloat StatusBarHeight = [[UIScreen mainScreen] scale] * 20;
CGImageRef CGImage = UIGetScreenImage();

UIGraphicsBeginImageContextWithOptions([[UIScreen mainScreen] bounds].size, YES, 0);
[[[UIScreen mainScreen] snapshotViewAfterScreenUpdates:YES] drawViewHierarchyInRect:[[UIScreen mainScreen] bounds] afterScreenUpdates:YES];

CGImageRef CGImage = [UIGraphicsGetImageFromCurrentImageContext() CGImage];

UIGraphicsEndImageContext();

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
BOOL isPortrait = UIInterfaceOrientationIsPortrait(orientation);
CGRect imageRect;
Expand Down
4 changes: 2 additions & 2 deletions make_screenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def compile_app():

# Force the simulator build to use 32-bit, otherwise UIGetScreenImage doesn't exist
if 'scheme_name' in options:
subprocess.call(['xcodebuild', '-scheme', options['scheme_name'], '-configuration', options['build_config'], '-sdk', 'iphonesimulator', '-derivedDataPath', 'build', 'clean', 'build', 'ARCHS=i386', 'ONLY_ACTIVE_ARCH=NO'], stdout=open('/dev/null', 'w'))
subprocess.call(['xcodebuild', '-scheme', options['scheme_name'], '-configuration', options['build_config'], '-sdk', 'iphonesimulator', '-derivedDataPath', 'build', 'clean', 'build'], stdout=open('/dev/null', 'w'))
else:
subprocess.call(['xcodebuild', '-target', options['target_name'], '-configuration', options['build_config'], '-sdk', 'iphonesimulator', 'clean', 'build', 'SYMROOT=build', 'ARCHS=i386', 'ONLY_ACTIVE_ARCH=NO'], stdout=open('/dev/null', 'w'))
subprocess.call(['xcodebuild', '-target', options['target_name'], '-configuration', options['build_config'], '-sdk', 'iphonesimulator', 'clean', 'build', 'SYMROOT=build'], stdout=open('/dev/null', 'w'))

os.chdir(previous_dir)

Expand Down

0 comments on commit daf3059

Please sign in to comment.