Fix potential memory leak in ARC

瘦欲@ 提交于 2019-12-04 07:47:55
NSString  *uuid =  (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuidObject);

Does that remove the warning?

Here is a way to release them:

- (NSString *) uuid
{
    CFUUIDRef uuidRef = CFUUIDCreate(NULL);
    CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
    CFRelease(uuidRef);
    NSString *uuid = [NSString stringWithString:(NSString *)
    uuidStringRef];
    CFRelease(uuidStringRef);
    return uuid;
}

Source: http://www.cocoabuilder.com/archive/cocoa/217665-how-to-create-guid.html

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