DaPo
DaPo

Reputation: 113

the warning "'uniqueIdentifier' is deprecated" in project based on cocos2d-box2d

I create a new project based on cocos2d-box2d, and there are always 4 warning in two files, one is CLScoreServerPost.m, the code has warning is following

[self addValue:[[UIDevice currentDevice] uniqueIdentifier] key:@"cc_device_id"];

and another is CLScoreServerRequest.m, the code has warning is following

device = [[UIDevice currentDevice] uniqueIdentifier];

both of them show the same warning: 'uniqueIdentifier' is deprecated

so what should I do? many thanks

Upvotes: 3

Views: 5413

Answers (2)

v_1
v_1

Reputation: 469

+(NSString *)GetUUID
{
    CFUUIDRef theUUID = CFUUIDCreate(NULL);
    CFStringRef string = CFUUIDCreateString(NULL, theUUID);
    CFRelease(theUUID);
    return [(NSString *)string autorelease];
}

Upvotes: 3

jptsetung
jptsetung

Reputation: 9157

You can use for example OpenUDID https://github.com/ylechelle/OpenUDID

As LearnCocos2D told in a comment there is also a topic on SOF : UIDevice uniqueIdentifier Deprecated - What To Do Now?

Upvotes: 2

Related Questions