Generate a UUID string with ARC enabled

后端 未结 3 793
春和景丽
春和景丽 2020-12-04 09:20

I need to generate a UUID string in some code with ARC enabled.

After doing some research, this is what I came up with:

CFUUIDRef uuid = CFUUIDCreate         


        
3条回答
  •  时光取名叫无心
    2020-12-04 10:01

    From clang docs:

    (__bridge_transfer T) op casts the operand, which must have non-retainable pointer type, to the destination type, which must be a retainable object pointer type. ARC will release the value at the end of the enclosing full-expression, subject to the usual optimizations on local values.

    So you are doing it right.

提交回复
热议问题