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 6636471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:11:24+00:00 2026-05-25T23:11:24+00:00

I have the following code where each object is a UISwitch IBOutlet property. I’m

  • 0

I have the following code where each object is a UISwitch IBOutlet property. I’m nor sure why I am getting a memory leak warning for each line when using xcode analyzer.

- (IBAction)copyEntirePreviousNoteButtonClicked:(id)sender
{
    self.myUISwitch1.on = TRUE;
    self.myUISwitch2.on = TRUE;
}

- (IBAction)updateButtonClicked:(id)sender
{
    NSMutableDictionary *copyOptions = [[[NSMutableDictionary alloc] init] autorelease];

    if (self.myUISwitch1.on) {
        [copyOptions setValue:@"ON" forKey:@"myUISwitch1"];
    }

    if (self.myUISwitch2.on) {
        [copyOptions setValue:@"ON" forKey:@"myUISwitch2"];
    }
}

Update with full code:

@property (nonatomic, retain) IBOutlet UISwitch *copy_hp_cchpi;
@property (nonatomic, retain) IBOutlet UISwitch *copy_hp_history;

- (IBAction)copyEntirePreviousNoteButtonClicked:(id)sender
{
    self.copy_hp_cchpi.on = YES;
    self.copy_hp_history.on = TRUE;
}

- (IBAction)updateButtonClicked:(id)sender
{
    NSMutableDictionary *copyOptions = [[[NSMutableDictionary alloc] init] autorelease];

    if (self.copy_hp_cchpi.on) {
        [copyOptions setValue:@"ON" forKey:@"copy_hp_cc_history_present_illness"];
    }

    if (self.copy_hp_history.on) {
        [copyOptions setValue:@"ON" forKey:@"copy_hp_med_fam_social_history"];
    }

    int rcode = [MyAPIDataSource copyPreviewAppointmentClinicalInfo:[MyAPIDataSource getCurrentAppointmentId] copyOptions:copyOptions];

    if (rcode) 
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Failed to copy last appointment information.  Please try again." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
        [alert release];        
    } 
    else 
    {
        //Send Notifications to other screens that clinical info was copied from last appointment to current one.
        [[NSNotificationCenter defaultCenter] postNotificationName:@"LastAppointmentLoadedHandler" object:self];

        [self dismissModalViewControllerAnimated:YES];
    }
}
  • 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-25T23:11:25+00:00Added an answer on May 25, 2026 at 11:11 pm

    After a lot of head scratching…

    By convention, any Objective C method that contains the word ‘copy’ is expected to return a retained object. The same applies for the method prefixes ‘init’ and ‘new’.

    The static analyzer knows about this convention and is complaining that your copyEntirePreviousNoteButtonClicked method does not return a retained object.

    The solution is not to name your methods containing the word ‘copy’ unless you really mean it. Stick to the Objective C method naming conventions. Change the name of your method and the problem will go away.

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

Sidebar

Related Questions

I have the following code: var words = new Object(); $(li.words).each(function(){ var thisId =
If I have the following code : threads = [] (1..5).each do |i| threads
I have the following code: Tag.find_all_by_company_id(4).each.collect{|tag| tag.name }.join(,) (Essentially I'm trying to build a
I have several blocks of the following code that each use there own matrix.
I have the following code which I use to match fancybox possible elements: $('a.grouped_elements').each(function(){
I have the following SQL code that runs against a Change Request database. Each
The following code returns the error from the For Each loop. I have similar
I have the following code: Private Sub txtFileFromLocation_TextChanged(ByVal sender As System.Object, ByVal e As
I have following code in page load Protected Sub Page_Load(ByVal sender As Object, ByVal
I have the following code which uses nested for-each loops to traverse two ArrayList

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.