manifestinteractive/easyapns — Issue #12: uniqueIdentifer is deprecated in iOS5 & errors with delegate.m
Author: jghankins
Created: 2011-10-20 02:12:48+00:00
State: open

Given that uniqueIdentifer is now deprecated in iOS 5, there are some issues that need to be worked.

First, check code in your delegate.m block using CFUUIDCreate. There is a missing ";" on line 50 and there is an error when trying to write as is to defaults if I skip remove the deviceUuid = dev.uniqueIdentifier. Instead I used:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
id uuid = [defaults objectForKey:@"deviceUuid"];
if (uuid)
deviceUuid = (NSString *)uuid;
else {

CFUUIDRef uuid;
CFStringRef uuidStr;

uuid = CFUUIDCreate(NULL);

uuidStr = CFUUIDCreateString(NULL, uuid);

deviceUuid = [NSString stringWithFormat:@"%@",uuidStr];
[defaults setObject:deviceUuid forKey:@"deviceUuid"];

CFRelease(uuidStr);
CFRelease(uuid);

}

Further the length check for the deviceuuid in the php class is currently looking for 40 and it appears they are now 37 (although I've not checked the docs yet to determine if this is always true. I also used a async http call as making a sync call in an app delegate is really not a good idea as it can block your UI.