Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7895489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:39:21+00:00 2026-06-03T07:39:21+00:00

There are a couple good examples on SO about CFUUID, notably this one: How

  • 0

There are a couple good examples on SO about CFUUID, notably this one:

How to create a GUID/UUID using the iPhone SDK

But it was made for pre-ARC code, and I’m not a CF junkie (yet), so can someone provide example code that works with ARC?

+ (NSString *)GetUUID
{
  CFUUIDRef theUUID = CFUUIDCreate(NULL);
  CFStringRef string = CFUUIDCreateString(NULL, theUUID);
  CFRelease(theUUID);
  return [(NSString *)string autorelease];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:39:22+00:00Added an answer on June 3, 2026 at 7:39 am

    You want a “bridged transfer”:

    + (NSString *)GetUUID
    {
      CFUUIDRef theUUID = CFUUIDCreate(NULL);
      CFStringRef string = CFUUIDCreateString(NULL, theUUID);
      CFRelease(theUUID);
      return (__bridge_transfer NSString *)string;
    }
    

    The Transitioning to ARC Guide says

    __bridge_transfer or CFBridgingRelease() moves a non-Objective-C pointer to Objective-C and also transfers ownership to ARC.

    However! You should also rename your method. ARC uses method name conventions to reason about retain counts, and methods that start with get in Cocoa have a specific meaning involving passing a buffer in for it to get filled with data. A better name would be buildUUID or another word that describes the use of the UUID: pizzaUUID or bearUUID.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

During this year there will be coming couple sub-600€ multi-touch portable computers that contain
There are couple of JSON frameworks. JSONKit , SBJSON , Native JSON and other.
There are a couple of resources on the Internet describing preview 2 of subsonic
There are a couple of data providers to interface with MySQL databases from .NET
In the .NET framework there are a couple of ways to calculate an MD5
During startup of my WinForms application I'm noting that there are a couple of
I have a library that does I/O. There are a couple of external knobs
After compiling/linking some .c .cpp and .h files, there are a couple of extra
Ok guys, just starting out with partitioning some tables in mySQL. There's a couple
There are already a couple of questions on finding cycles, but I did not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.