Wednesday 15 May 2013

Non-public API usage woes

First and foremost if you have come across my post you have my condolences.  Not because of landing here but more you must have gone through the frustrating exercise that I have lost 3 days of my life to.

Having deployed my latest version of 1800 to app store I couldn't understand why I was greeted with the email of:

Non-public API usage:

Apps are not permitted to access the UDID and must not use the uniqueIdentifier method of UIDevice. Please update your apps and servers to associate users with the Vendor or Advertising identifiers introduced in iOS 6.
If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed.

If you think this message was sent in error and that you have only used Apple-published APIs in accordance with the guidelines, send the app's nine-digit Apple ID, along with detailed information about why you believe the above APIs were incorrectly flagged, to appreview@apple.com. For further information, visit the Technical Support Information page.

... and an invalid binary for my efforts.  This has all come about due to a new privacy policy instilled by Apple on the 1st May 2013 which prohibits the use of using the devices UDID for tracking or identification.  If you want to read a bit more about it check it out here.

I am going to write about my experiences but I will summarise so that you can go away and solve the problem now but come back to perhaps pick up a few tips.

Tip #1 and my solution - Update AdMob SDK

Just to be clear I am using Unity, Futile and Prime31 plugins.  At first I thought it was the Prime31 plugins as I am only using Unity and those. The problem was the Adwhirl plugin from Prime31 but more specifically the AdMobs SDK. All you have to do is download the latest SDK for here and then copy its contents to assets/editor/AdWhirlAdMob folder. All being way you can see your friend again of "Waiting for review".

While Prime31 don't use the UDID uniqueIdentifier I was ignorant to how the AdMobs SDK was updated and assumed when I updated the Prime31 Adwhirl plugin it updated the third party SDKs.  Not the case so you have been warned. I also had a red herring as Astavoid didn't have AdWhirl plugin in its project but somehow was in the editor folder which meant I had earlier eliminated this plugin as an issue as it wasn't (in theory) across both apps.

If you have got this far into the blog then perhaps the above hasn't worked.  If thats the case then all is not lost.  I've tried a few things to try and get the solution above so maybe be these will help.

Tip #2 - Find and replace uniqueIdentifier
From within XCode do Cmd-Shift-f and search for:

[[UIDevice currentDevice] uniqueIdentifier].

This should list out all instances of this method.  Instead using the above method use a hash of the mac address like:

+ (NSString *)GetUUID
{
  CFUUIDRef theUUID = CFUUIDCreate(NULL);
  CFStringRef string = CFUUIDCreateString(NULL, theUUID);
  CFRelease(theUUID);
  return [(NSString *)string autorelease];
}

or as alternative within code base use this method instead

 [UIDevice identifierForVendor] 

Tip #3 - Command Tools
Still getting rejected then the chances are one of your compiled libraries or frameworks has the little blighter in.  If so not a problem (well not yet anyway). I don't profess to be an expert in this area so apologies if factually incorrect and happy to be corrected for the greater good :)

Download XCode command tools.  Easier send than done you say.

Xcode includes a new "Downloads" preference pane to install optional components such as command line tools, and previous iOS Simulators. To open this pane click the "Xcode" button in the top left of the screen near the Apple logo, then click "Preferences", then click "Downloads".


Once downloaded open up a terminal window and navigate to where your xcode project is located. Then choose your framework files or libraries you want to check with the strings command of:

strings <your file>.a | grep uniqueIdentifier

This will then iterate through the files looking for the method you specified as the last parameter.  This will allow an investigation and the next area of investigation.

Hope this helps I certainly know information was scarce so if it just helps a couple of people then it will alleviate some pain that I had to go through :)

2 comments:

Anonymous said...

wow!!!
the great blog.
the game is very innovative and interesting.
hats off to the designers.

Kill By Captcha

Unknown said...

Wow!!! Nice... Superb Blog... Excellent theme..


death by captcha

Post a Comment

 
;