Question

We have an old app created with PhoneGap version 1.0. There is absolutely no chance to migrate to latest PhoneGap/Cordova because of huge changes in both iOS/JS code required.

An attempt to upload an app compiled with iOS SDK 6.1 failed with message: "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.".

PhoneGap 1.0 sources are not available in public, it's distributed as compiled framework.

Does anyone have an idea how to workaround this issue?

Était-ce utile?

La solution

Crazy, but WORKING solution (hack)

Well, once PhoneGap 1.0 is provided as compiled lib, we can try to change the compiled binary itself.

The reason of Apple reject are calls to [UIDevice uniqueIdentifier] method deprecated in iOS 6. If your app (JS code) does not use UDID provided by PhoneGap (actually, have no idea is there a way to get it), it's safe (!? see NOTE bellow) to change the call of uniqueIdentifier to any other method returning NSString of UIDevice class.

I've used +(NSString *)systemVersion - getter of systemVersion property.

So, get any HEX editor and open file: /users/Shared/PhoneGap/Frameworks/PhoneGap.framework/PhoneGap replace uniqueIdentifier with systemVersion\0\0\0.

\0 - are zero code bytes, needed to align the length of new name which is 3 bytes shorter!

Rebuild your app, and… viola upload to AppStore succeeded!

NOTE: Sure, you MUST check your app functionality not broken. I did for mine app and it works like a charm.

Autres conseils

Nope. Apple is your issue here. You have to update your PhoneGap to at least 2.5, see posting here: https://shazronatadobe.wordpress.com/2013/05/01/cordovaphonegap-and-the-new-apple-app-store-requirements/

And you have to update any plugin or native you wrote to not use uuid.

I had the same issue using phonegap 1.2.0 but the above "hack" didnt work for me - it gave me an error

ld: file is universal (3 slices) but does not contain a(n) armv7 slice:

So instead I found a much easier solution - locate the PhoneGapLib.xcodeproj that gets installed when you install phonegap and open it, then search for the "uniqueIdentifier" call.

Then I used the below code taken from here (https://stackoverflow.com/a/9458313/1851746) in order to substitute the UUID value -

- (NSString *)getUUID
{
    NSString *UUID = [[NSUserDefaults standardUserDefaults] objectForKey:@"uniqueID"];
    if (!UUID)
    {
        CFUUIDRef theUUID = CFUUIDCreate(NULL);
        CFStringRef string = CFUUIDCreateString(NULL, theUUID);
        CFRelease(theUUID);
        UUID = [(__bridge NSString*)string stringByReplacingOccurrencesOfString:@"-"withString:@""];
        [[NSUserDefaults standardUserDefaults] setValue:UUID forKey:@"uniqueID"];
    }
    return UUID;
}

Calling this method with [self getUUID] instead of uniqueIdentifier works though for some reason it led to an error with a subsequent value added to the dictionary for the phonegap version. So I just hard coded this instead in the same block as the above.

Then change target to "PhoneGap", build, then go to the Products folder and open location in finder, copy the framework folder, and replace the one found in Users/Shared/PhoneGap/Frameworks.

Project should compile and be accepted to the App Store

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top