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

≡放荡痞女 提交于 2019-12-10 18:49:22

问题


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


回答1:


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?




回答2:


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


来源:https://stackoverflow.com/questions/8051708/the-warning-uniqueidentifier-is-deprecated-in-project-based-on-cocos2d-box2d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!