Screenshots-A Legal Way To Get Screenshots

Screenshot 2011 03 25 04 23 15Note: Please remember that this post is over 5-years old, is not therefore current, so code at your own risk.

Well, Screenshots is finally done. So, what took so long since the last post about Screenshots on March 7th?

The worst thing about having perfectionist attributes is that sometimes they are detriments. Take, for example, my initial Screenshots demo app. Yes, it worked in so much as it did demonstrate that by using Apple’s Q&A 1702, 1703, 1704, and 1714 you could get they type of screen shot, or screen image, that you could by using UIGetScreenImage(). But it was…how best to put it, so ugly that not even its coder (I) could love it. So I rewrote it. All of it. And then I added features. Yeah…like I said, a detriment.

Ok…so what took so long?

Continue reading

How To Legally Replace UIGetScreenImage()

Note: Please remember that this post is over 5-years old, is not therefore current, so code at your own risk.

In the summer of 2010, Apple opened up UIGetScreenImage() as a way of taking screenshots in iOS apps. There was great joy in the land.

Then the following September, Apple decided that it was better for app developers to use either UIImagePickerController or methods from AVFoundation to capture images and present a camera view. Happiness was replaced with great sadness in the land.

To help developers, Apple’s iOS Team came out with 4 Technical Q&A’s that tried to show developers how to get around the prohibition on UIGetScreenImage() while still accomplishing the same thing. To put it simply, what had been a one-line job became a many line task.

Worse, in none of the Apple supplied Technical Q&A’s was there an elegant solution for those interested in augmented reality applications…such as I, to take a screen shot. So, in plain English, if you wanted a screenshot of your augmented reality app including its UIKit layer content, sort of like…well, a gun camera, you were out of luck. This bothered me greatly.

Continue reading

When NSString Doesn’t Create A String With A String

If one goes to the NSString documentation, one quickly realizes that there is a very nice convenience method,

+ (id)stringWithString:(NSString *)aString

Parameters
aString

    The string from which to copy characters. This value must not be nil.

Important:
Raises an NSInvalidArgumentException if aString is nil.

Return Value
A string created by copying the characters from aString.

One would be forgiven for not noticing that little note that is supposed to catch your attention by having the title, Important. And it is important. Because, let’s say that you are trying to tell your iOS user how much an app feature upgrade cost,


NSString *titleString1 = [NSString stringWithString:@"Upgrade Flush'em for "];
NSString *titleString2 = [NSString stringWithString:[PFIAPManager sharedManager].upgradePrice];
NSString *titleString3 = [titleString1 stringByAppendingString:titleString2];
NSString *titleMessage = [titleString3 stringByAppendingString:@"?"];

Now let’s say that your intrepid customer doesn’t have a network connection. Yes, you can go through the mental exercise of asking why in the world a user would try to upgrade a mobile app without a network connection, but trust me, it will happen. And you as a responsible programmer must catch that error and handle it well for the customer. And how would you do that?


NSString *titleString2 = nil;
NSString *upgradePriceStr = [PFIAPManager sharedManager].upgradePrice;
if (upgradePriceStr)
{
titleString2 = [NSString stringWithString:upgradePriceStr];
}

BrokenFang Progress 7 January 2007

The task I have been dealing with for the last day or so is how to allow the user to set–or not–a background image, then add images, if they like reset the background image and NOT have that NEW background image cover the previous images. Almost have it licked. So far, my thinking has been to accompany any images loaded, after the initial background image is loaded, with an off-screen loading of those images. So, when setting a new background image, I wipe the window, load a new background image, then redraw the window–atop the new background image–from the off-screen window using Quartz Layers.

I’ve also been looking into CoreData lately since it might be a nice way to manage the various images being loaded/unloaded. I’ve never worked with CoreData, but those who have say it is liberating…once you get past the learning hump, which is a bit high since the only textbook on it is Apple’s documentation. Like the docs for Cocoa Bindings, which CoreData meshes with very closely, the docs for CoreData trend towards the theory and not the practice of using this stuff.

I may switch everything over to Leopard since there’s a rumor that the NSImage and like Cocoa classes have been bolstered under 10.5. Will have to wait and see.

Hello out there!

Welcome to BrokenFang.com, a site that reflects my bipolar, multiple personality of code, space, and Labrador retrievers. I also will throw in some fiction I’m working on, which I want, really want, your feedback on. There will be occasional code also kicked in as well.

Why BrokenFang? Well, the name is nothing profound, not certainly anything like what someone once asked, “Is Broken Fang some ancient native American name”? Nope. In fact, the name Broken Fang comes from a nickname I gave to my yellow Lab, Elizabeth, who chipped off half of one of her canines while playing with her favorite toy…that being a 15 lbs. mesquite log she pulled out of the woodpile. So there you have it, the story behind BrokenFang.