【问题标题】:Call to function 'CFUUIDCreate' returns a Core Foundation object with a +1 retain count调用函数“CFUUIDCreate”返回一个具有 +1 保留计数的核心基础对象
【发布时间】:2012-09-19 18:47:54
【问题描述】:

在项目中添加了共享工具包组,发现很多编译警告已修复,但其中大部分仍然显示。

这个来自 OAMutableURLRequest.m 类

- (void)_generateNonce
{
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
NSMakeCollectable(theUUID);// **Reference count decremented on this line**
nonce = (NSString *)string; //**Incorrect decrement of the reference count of an object that is not owned at this point by the caller on this line**
}

不知道如何解决这个问题。

感谢您的帮助。

【问题讨论】:

    标签: iphone ios sharekit


    【解决方案1】:

    解决了。实际上我并没有分享在这种情况下要发布的内容,但是当我添加时

     - (void)_generateNonce
     {
    CFUUIDRef theUUID = CFUUIDCreate(NULL);
    CFStringRef string = CFUUIDCreateString(NULL, theUUID);
    NSMakeCollectable(theUUID);
    nonce = (NSString *)string;
    //[string autorelease];
    CFRelease (theUUID);
    }
    

    成功了。看起来我负责释放我在 CFUUIDCreate 中分配的 UUID。

    【讨论】:

      猜你喜欢
      • 2023-03-19
      • 1970-01-01
      • 2011-04-02
      • 2011-11-27
      • 1970-01-01
      • 2012-03-05
      • 2013-12-09
      • 2011-02-19
      相关资源
      最近更新 更多