Posts

Post not yet marked as solved
7 Replies
4.3k Views
This should be pretty simple:@import Foundation;...NSString *uuid = [[NSUUID UUID] UUIDString];This ALWAYS returns "nil" objectshould return something like: "68753A44-4D6F-1226-9C60-0050E4C00067"I recently found this about it, and it's definitely nil EVERY SINGLE TIME...Because of the way NSUUID's are wrappers of CFUUID's in one of the most bizzarre nonsense "toll free bridging" that I have run across in Foundation, NSUUID's cannot be used as keys, stored in another containers for any extended period of time, or even subclassed. You always must use the string representation as the key. In fact the longer you hold on to an NSUUID, the more likely you are to discover that it's underlying representation has been deallocated from under you and it can no longer return the value that it returned shortly after alloc/init. Fun stuff.SEE: post: Re: Background Session Task state persistenceBugReported:22939495- (NSString *)getUUID{ CFUUIDRef uuid = CFUUIDCreate(NULL); NSString *uuidStr = (__bridge_transfer NSString *)CFUUIDCreateString(NULL, uuid); CFRelease(uuid); return uuidStr;}This is also always returning 'nil'
Posted Last updated
.