Archive for March 2013

Xcode 4.6 Organizer crash on update

Well I had a nice little issue with Xcode. Whenever I would try to do something in Organizer that had to sign into my Apple developer account (refresh provisioning profiles, add a device to a provisioning profile, etc.), it would ask for my credentials, chug for a moment, and then slip out the back door like it was late for a date with a supermodel.

Luckily, today I got frustrated with this issue and did some digging. I found a post on Apple’s forums about getting rid of some Library files created and used by Xcode, and after I removed the two files in question, lo and behold it started to be non-crashy again. Bonus.

The files were in the folder “~/Library/Developer/Xcode/” and begin with “connect1.apple.com”. Apple’s post says to move the files, but I just blew them away and it seemed to work fine. Here is the post on the Apple web site: (you may need to log in with your Apple developer account to see this posting)

Xcode 4.6.1 crashing while interacting with the Developer Portal

BTW, Happy Birthday to Routzy! We had our one year birthday party for Routzy tonight at Vito’s Wine Bar in Delaware, Ohio. Thanks to all who turned out, and wait until you see what we have in store for Routzy in year 2.

Post script: Happy Belated 40th Birthday to The Young and The Restless.

iOS NSRegularExpression to detect UUID

In keeping with my attempt to use more regular expressions in .NET, I figured it would be a good exercise to try and use NSRegularExpression to do some checking in my iOS app.

I have a situation where an array of strings come in, and I need to know which of them are UUIDs and which are not. Here is the code that I wrote to accomplish the UUID checking, it is implemented as a category of NSString:

#define UUID_PATTERN    @"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
 
- (BOOL)isUUID
{
    NSRegularExpression *regex;
    regex = [NSRegularExpression regularExpressionWithPattern:UUID_PATTERN
                                                      options:NSRegularExpressionCaseInsensitive
                                                        error:nil];
    int matches = [regex numberOfMatchesInString:self options:0
                                           range:NSMakeRange(0, [self length])];
    return (matches == 1);
}

To use this NSString category, you would just do something like this:

NSLog(@"Is %@ a UUID? %@", theTestString, ([theTestString isUUID] ? @"YES" : @"NO"));

BTW, as far as I am concerned, Google laid a couple of eggs the last two days. Firstly, yesterday (Wednesday, March 13) I tried for almost an hour to get Google I/O tickets, to no avail. I was hoping to attend as my trip to I/O last year was interrupted by my father passing away. Then, this morning, news breaks that Google is killing off Google Reader. My opinion of Google has gone down a couple of notches.

Double Bonus BTW: Happy Pi Day everyone! See you at Stir Trek!!! (Yes, I got tickets for that one. Whew…)

Mamas, don’t let your babies grow up to put important code in the dealloc method

Here is something you may not have noticed (yet). If you use the ZipArchive code to create zip files in your iOS app, and you convert your app code to ARC, your zip files might not be created correctly. The problem exists here in the ZipArchive.mm file:

-(void) dealloc
{
	[self CloseZipFile2];
	[super dealloc];
}

If you use the CreateZipFile2 method to create your zip file, previously you would call the release method on your ZipArchive object, and the memory would be flushed away. Unbeknownst to you (but beknownst to the ZipArchive devs), your zip file was A-OK because of the CloseZipFile2 method call in the dealloc method.

But ARC conversion removes the release messages! Bugger!!! Just manually put in a call to CloseZipFile2 everywhere that you use the CreateZipFile2 method.

BTW, Happy Birthday to Kent Tekulve, former Pirates great and commissioner of the Pittsburgh Pirates Fantasy Camp. Unfortunately Teke could not make it to camp due to illness this year, we missed you Teke and hope you are feeling better.