Sunday, December 30, 2012

Care when posting from the web

I've been working on a new application (Electronic Detective for my daughter) which will be the basis for a longer-term game effort and ran into a strange thing. I decided that how I was going to be doing the UI for a particular portion of the game was just incredibly clunky. I had remembered a piece of information that needed to be included and rather than shoehorn it in, I decided to take a step back and see what made the most sense. In this case it was changing things from a static UIView to a UITableView. This opened up a lot of potential real estate and made it possible to do some things I was struggling to fit on the screen before.
I was searching to find the best way to get UITableViewCells working with the new Xcode (4.5) since they've sort of changed how they operate since last I'd done one (a long time ago - in a galaxy far, far away). I found a good sample from a blog post and decided to just copy/paste and modify the sample code. And things were fine - until I got a very strange build error - "unexpected '@' in program". Um, whiskey tango foxtrot was that? I searched a bit more and the answers proposed didn't seem to really address my particular error. Here was the offending code (from a code blog I found):

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
 static NSString *CustomTableCellIdentifier = @”CustomTableCellIdentifier”;

 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CustomTableCellIdentifier];

 if(!cell)
 {
   NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@”CustomCell” owner:self options:nil];

 if(nib.count > 0)
 {
   cell = self.customCell;
 }
 else
 {
   NSLog(@”failed to load CustomCell nib file!”);
 }
 }
 
There didn't really seem to be anything wrong. The highlighted lines were the ones causing the problem and I couldn't really see a problem. Each of the literals was perfectly correct. What the hell was going on with this code? Then I stumbled upon a stackoverflow question and answer that provided a little insight. What was weird about the editor was that it wasn't showing the text formatted as "text" - it was just showing as black text, not the typical red you'd see. Then I read the part about the "smart quotes". I replaced the first "quote" with a regular "quote" and the text higlighted. That's when I realized I must have pasted in smart quotes and that's what was causing the problem.
I replaced all six quotes and things started working the way I expected. So, as a word of caution, Xcode apparently will maintain some special characters when you paste code from other sources. Make sure that if you're pasting that you double-check the characters. If things don't look correct to you, they probably aren't. It may be a bit weird, but it may be worth your effort to retype some of it manually in the editor to see if it's a problem with the paste or with the code. You could save yourself a little mental anguish by trying a couple of simple things. Good luck and happy coding.


Wednesday, December 19, 2012

Maya Long Count Updates

It has been a pretty busy couple of months. The first thing was that I ran into the problem with the glyphs. I got all of the new glyphs redrawn, scanned, cleaned up, and integrated into the application. That took about a month to sort out. I did get everything integrated and here's the screen shot from the main screen. Once that was done, I then submitted to the App Store. It was the first application that I've published into the App Store (link here). Given that it was a total "stealth launch"it's been doing a bit better than I expected. Last night I tweeted:
"This is cool. I've earned $3.50 US, $1.26 Australian, $0.70 Canadian, €1.08, and ¥60 from my app. Taxes should be interesting."
Overall there have been 17 sales in 6 countries. I'm interested to see what happens after the end of this b'ak'tun - whether there will be additional interest or if I'll see my sales drop to zero.
I decided to do a free, ad-supported version as well. Hooking up the iAd banner was surprisingly straight-forward. It took very little time to get the banners installed but when I started looking at doing the full-screen ads I've seen in other apps I found out quickly that the iAd network doesn't do it for iPhone - just iPad.
I've been playing with the idea of using Greystripe at one point and this provided the opportunity to get it integrated. With iAd's lack of full screen ad support on iPhone, Greystripe was the solution. The was a problem, though, in that the test ID that they provided failed to work properly. I "violated" the terms a little a turned on the ads while I was testing. Given that I had done most of the work already around the testing, going with "live" ads wasn't a gigantic hit on the volumes (I think I used 7 impressions for testing).
I did get the free (lite) version submitted to the App Store on December 12th and it sat in review for a few days. I did get a notification yesterday that it was being reviewed and very quickly went from "In Review" to "Ready for Sale". Here is the timing on that:
 I was amazed that it was less than 2 hours from start to finish. Overall it was pretty amazing to see how quickly they got it squared away. Admittedly there was already one there that was practically the same thing but it was a different application. My original app took almost 2 days in review. This was 2 hours.
Anyway, both apps are now officially available for sale and Otto Von Productions, Inc. has published and sold its first applications. Now I just need to get the other 41 ideas I've got swimming in my head completed and published. Maybe I'll end up making this whole thing work after all.