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

  • SEARCH
  • Home
  • 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 7697731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:04:51+00:00 2026-05-31T22:04:51+00:00

I`m getting the following warning. Reference-counted object is used after it is released ARC

  • 0

I`m getting the following warning.

Reference-counted object is used after it is released

ARC is enabled for this file.

I have not converted my app to use ARC and don`t have an proper understanding of it at this time. However, at a glance I am puzzled why this code should have a problem (its from a library), I mean I know autorelease should not be used here?

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    id uuid = [defaults objectForKey:@"uniqueID"];
    if (uuid)
        uniqueID = (NSString *)uuid;
    else {
        CFStringRef cfUuid = CFUUIDCreateString(NULL, CFUUIDCreate(NULL));
        uniqueID = (__bridge NSString *)cfUuid;
        CFRelease(cfUuid);
        [defaults setObject:uniqueID forKey:@"uniqueID"]; // warning here
    }

EDIT
@JohnCalsbeek, @epatel, @Chuck
Thanks, I’ve just tried that and I get a new warning on CFStringRef cfUuid line, saying potential leak.

Heres the full file https://github.com/MugunthKumar/MKStoreKit/blob/master/MKSKProduct.m

  • 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-05-31T22:04:52+00:00Added an answer on May 31, 2026 at 10:04 pm

    Try this one, srry for the miss understanding haha

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    id uuid = [defaults objectForKey:@"uniqueID"];
    
    if (uuid)
        uniqueID = [NSString stringWithString:(NSString *)uuid];
    else {
        CFUUIDRef temp = CFUUIDCreate(NULL);
        CFStringRef cfUuid = CFUUIDCreateString(NULL, temp);
        uniqueID = [NSString stringWithString:(__bridge NSString*) cfUuid];
        CFRelease(cfUuid);
        CFRelease(temp);
    
        [defaults setObject:uniqueID forKey:@"uniqueID"]; // warning here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After using the analyze tool, I am getting the following warning Object leaked: Object
I am getting the following warning: A reference was created to embedded interop assembly
After upgrading to new Android tools, I am getting following warnings from Proguard: Warning:
This morning I started getting the following warning when running tests. DEPRECATION WARNING: <%
I am getting the warning: Call-time pass-by-reference has been deprecated for the following lines
I'm getting following warning and I have no idea what to do about it.
While creating the setup for VB.net application I am getting the following warning: Warning
I'm building a webpage and I'm getting the following warning (and the page loads
When compiling my wxWidget HelloWorld application, I am getting the following errors: Warning 1
I am getting the following errors: PHP Warning: Module 'ldap' already loaded in Unknown

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.