the warning “'uniqueIdentifier' is depreca

2019-07-04 01:52发布

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

2条回答
放我归山
2楼-- · 2019-07-04 01:58
+(NSString *)GetUUID
{
    CFUUIDRef theUUID = CFUUIDCreate(NULL);
    CFStringRef string = CFUUIDCreateString(NULL, theUUID);
    CFRelease(theUUID);
    return [(NSString *)string autorelease];
}
查看更多
放我归山
3楼-- · 2019-07-04 02:07

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?

查看更多
登录 后发表回答