Okay:
From the looks of your bug report you seem to be reporting that the debugger cannot find the value for the uuid or the string, but the debugger also seems to be reporting that optimizations may have eliminated the variable.
I highly suspect that you are not in fact getting a nil UUID – you are simply seeing artifacts of optimization.
Response..
If I breakpoint the line after: NSString *uuidString = [[NSUUID UUID] UUIDString];
and uuidString is nil, then the optimizer is being WAY TOO AGGRESSIVE. I should be able to access that value at least once.
Next:
Also your other assertions that it cannot be used as a key in NSDictionary seem incorrect on the face of it – NSUUID conforms to NSCopying and properly implements -isEqual:, which is all that is necessary to be a dictionary key. What issues are you seeing that prevent it from being used as a dictionary key?
As for subclassing you are correct – NSUUID is not meant to be subclassed, but on the face of it I fail to see the utility of doing so. Do you have a use case for doing so in mind? Also as stated in the documentation, NSUUID is not toll-free bridged to CFUUIDRef, as such they cannot be used interchangeably.
I would suspect that the most likely reason you might be having issues is that you might be overreleasing the NSUUID. If you are routinely using __bridge_transfer and __bridge_retained you may be inadvertantly breaking your objects by breaking their ownership graph.
Response:
I was actually searching for a reason the string never receives a value, and copy pasted stuff from other threads that may be associated with this issue I am having. SEE Conversation with the title: Re: Background Session Task state persistence. Also, some code I was referring to was from an older topic from before the UUIDString property was added, that I found on Stack Overflow:
-(NSString*) myUUID()
{
CFUUIDRef newUniqueID = CFUUIDCreate(kCFAllocatorDefault);
CFStringRef newUniqueIDString = CFUUIDCreateString(kCFAllocatorDefault, newUniqueID);
NSString *guid = (__bridge NSString *)newUniqueIDString;
CFRelease(newUniqueIDString);
CFRelease(newUniqueID);
return([guid lowercaseString]);
}
This code also came up with nil for some reason.
Lastly:
Alternatively you might try verifying you don't have conflicts in some shared library or framework that you are using – in a simple application I can't get [NSUUID UUID] or -UUIDString to return nil.
There might be something with library coflicts, but I don't believe there is anything defining a class NSUUID, and can't think of any reason there would be a conflict that would affect the call to: [[NSUUID UUID] UUIDString], unless a library we're using is defining such a class,and calling it NSUUID, and that class also had the property UUIDString defined, or there would be and exception.
So, at the very least I have an issue with my system's current configuration and XCode, and have some corruption or some other wacky thing. But, since I am able to reproduce it every single time, I would think someone at Apple might like to SEE it. I would be happy to let someone, at Apple, remote in so you can see for yourself what's happening.
At this point, the only thing I really need is a somewhat reliable Unique String I can use for some messaging between my server and the iOS app, so I can differentiate between asynchronous message responses. So, I will just try coming up with my own function that generates a psuedo UUID string.