【问题标题】:the warning "'uniqueIdentifier' is deprecated" in project based on cocos2d-box2d基于 cocos2d-box2d 的项目中的警告“'uniqueIdentifier' is deprecated”
【发布时间】:2011-11-08 14:12:36
【问题描述】:

我基于cocos2d-box2d新建了一个项目,两个文件中总是有4个warning,一个是CLScoreServerPost.m,代码有warning如下

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

另一个是CLScoreServerRequest.m,代码有警告如下

device = [[UIDevice currentDevice] uniqueIdentifier];

它们都显示相同的警告:'uniqueIdentifier' 已弃用

那我该怎么办?非常感谢

【问题讨论】:

标签: cocos2d-iphone box2d uniqueidentifier


【解决方案1】:
+(NSString *)GetUUID
{
    CFUUIDRef theUUID = CFUUIDCreate(NULL);
    CFStringRef string = CFUUIDCreateString(NULL, theUUID);
    CFRelease(theUUID);
    return [(NSString *)string autorelease];
}

【讨论】:

    【解决方案2】:

    您可以使用例如 OpenUDID https://github.com/ylechelle/OpenUDID

    正如 LearnCocos2D 在评论中所说,还有一个关于 SOF 的主题:UIDevice uniqueIdentifier Deprecated - What To Do Now?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多