Search code examples
spotifycocoalibspotify-2.0libspotify

libspotify causing Apple App store rejection


Looks like Apple has tightened app store submissions staring May 1. I have an app that uses Spotify and have been accepted into the App Store multiple times. On a recent update, the app was rejected for the following reasons...

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.

Doing the following on libspotify

strings libspotify | grep uniqueIdentifier

returned 3 instances of uniqueIdentifier. Another posting stated that this is probably due to openSSL and may have nothing to do with UDID. However, Apple is rejecting the code. Is there a work-around?


Solution

  • Here is a Cr4zY quick-fix, use only if you are in a real hurry (like I am right now, Ship or Die!)...

    Use a tool like 0xED http://www.suavetech.com/0xed/ to change the uniqueIdentifier parts in the libspotify binary to something like uniqueXdentifier. (Note! Has to have same length or it will break hard!!!)

    Then add a category method for UIDevice i.e. like this in your project (using same name as was changed to)

    static NSString *alternativeUniqueIdentifier = nil;
    
    #define DEFAULTS_KEY @"heartbreakridge" // "Improvise, adapt, overcome" - Clint Eastwood in DEFAULTS_KEY
    
    @interface UIDevice (CrazyFix)
    - (NSString *)uniqueXdentifier;
    @end
    
    @implementation UIDevice (CrazyFix)
    
    - (NSString *)uniqueXdentifier
    {
        if (!alternativeUniqueIdentifier) {
            @synchronized(self) {
                alternativeUniqueIdentifier = [[NSUserDefaults standardUserDefaults] stringForKey:DEFAULTS_KEY];
                if (!alternativeUniqueIdentifier) {
                    // XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX (capital hex)
                    CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault);
                    CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
                    CFRelease(uuidRef);
                    alternativeUniqueIdentifier = [(NSString*)CFBridgingRelease(uuidStringRef) lowercaseString];
                    alternativeUniqueIdentifier = [alternativeUniqueIdentifier stringByReplacingOccurrencesOfString:@"-" withString:@""];
                    alternativeUniqueIdentifier = [NSString stringWithFormat:@"%@%@", [alternativeUniqueIdentifier substringToIndex:8], alternativeUniqueIdentifier];
                    [[NSUserDefaults standardUserDefaults] setValue:alternativeUniqueIdentifier forKey:DEFAULTS_KEY];
                    [[NSUserDefaults standardUserDefaults] synchronize];
                }
            }
        }
        return alternativeUniqueIdentifier;
    }
    
    @end