identifierForVendor changes on background thread near startup on 9.3 Simulator

Originator:matthew.patey2167
Number:rdar://25386801 Date Originated:28-Mar-2016
Status:Open Resolved:
Product:iOS Product Version:Simulator 9.3
Classification: Reproducible:Always
 
Summary:
On iOS simulator 9.3, the UIDevice method "identifierForVendor" does not consistently return the same value if called at the beginning of the app lifetime from a background thread. If called in the background near app startup, it returns a different value then it does when called on the main thread or when called in the background at a later point in the app lifetime.

Steps to Reproduce:
1. Use the attached code in an app's AppDelegate.
2. Run on a iOS Simulator 9.3.
3. Observe the two printed values are different.

Note that the values printed will be the same if you either uncomment the sleep or run on iOS simulator <= 9.2

Expected Results:
In the simulator, vendor id should be the same on every call in a single app launch.

Actual Results:
The value returned early in the app life on a background thread is different then when called later or when called on the main thread.

attachment:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//        [NSThread sleepForTimeInterval:1];
        NSLog(@"vendor id background: %@", [[[UIDevice currentDevice] identifierForVendor] UUIDString]);
        
    });
    
    NSLog(@"vendor id: %@", [[[UIDevice currentDevice] identifierForVendor] UUIDString]);
    return YES;
}

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!