开发者

Do I need to release an NSString created by CFUUIDCreateString()?

I am creating a NSString like this, should I release it afterwards or not?

CFUUIDRef   uuidObj = CFUUIDCreate(nil);
        NSString *device = (NSString*)CFU开发者_运维百科UIDCreateString(nil, uuidObj);
        CFRelease(uuidObj);

Thanks!


Here is documentation for this function:

CFUUID Reference - CFUUIDCreateString

and it states that ownership follows The Create Rule.

Here are some more links with answer:

  • Memory management with CF Objects
  • Strings from UUID


CFUUIDRef theUUID = CFUUIDCreate(NULL);

NSString *s2ndUuid = (__bridge_transfer NSString*)CFUUIDCreateString(kCFAllocatorDefault, theUUID);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜