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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:49:47+00:00 2026-06-01T16:49:47+00:00

Currently attempting to save an array that is populated according to which cells in

  • 0

Currently attempting to save an array that is populated according to which cells in a UITableView are chosen and saving this array in an instance of a seperate object. I am getting the array to populate just fine, however, my save method, which is an IBAction that is invoked by clicking on a Bar Button doesn’t seem to be working. Here is some code:

-(IBAction)saveWorkout:(id)sender {
    Workouts *new = [[Workouts alloc] init];
    [new addNewWorkout:customWorkout];

    [customWorkout removeAllObjects];
}

This code is from the first class.

And here is the code for my addNewWorkouts method in the Workouts class:

-(void)addNewWorkout:(NSMutableArray*)array {
    NSMutableArray *temp = [[NSMutableArray alloc] init];
    temp = array;

    self.workoutList = temp;

    [temp release];

}

Here is my “Workout.h”

#import <Foundation/Foundation.h>


@interface Workouts : NSObject {
    NSString *workoutName;
    NSMutableArray *workoutList;
    NSString *description;
    int *reps;
    int *weights;
    int *sets;
}
@property (nonatomic, retain) NSString *workoutName;
@property (nonatomic, retain ) NSString *description;
@property (nonatomic, retain) NSMutableArray *workoutList;

-(void)addNewWorkout:(NSMutableArray*)array;

@end

Before running this code, I get a Warning from Xcode saying that ‘Workouts may not respond to ‘addNewWorkouts.’

Anyone know what is causing this error? Once I build & run, I click on the Save button and the app crashes with a unrecognized selector sent to instance 0x3b04410 error.

  • 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-01T16:49:48+00:00Added an answer on June 1, 2026 at 4:49 pm

    You call [new addNewWorkouts:customWorkout]
    when the method’s selector is addNewWorkout: (note that there is no plural in the method name)

    This will make a bad method call and result in a crash.

    Also, there is a problem with the memory management of the addNewWorkout method.

    1- NSMutableArray *temp = [[NSMutableArray alloc] init];
    2- temp = array;
    3- self.workoutList = temp;
    4- [temp release];
    

    You allocate a new NSMutableArray on line 1, then lose its reference on line 2 when you replace its pointer by ‘array’. The allocation you just made is lost and the program will leak.

    Then, on line 4, you send a release message to ‘temp’ which actually points to ‘array’, resulting in the release of the parameter that you received and not the temporary object.

    Is there a reason whny you create a temporary array? You can just assign the property and make the property copy or retain it, depending on your needs.

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

Sidebar

Related Questions

I am currently attempting to use Lucene to search data populated in an index.
I am currently attempting to have the browser automatically prompt the user to save
I am currently attempting to build a web application that relies quite heavily on
I am currently attempting to find a suitable xpath that will help me validate
I am currently attempting to create an Inno script installer which requests a list
I'm attempting to save my array of players into a JSONArray , convert it
So currently I am attempting to save an indexPath and access it, yet I
I'm currently attempting to create a tabbed interface in a web application, and based
I am currently attempting to implement a custom gridview interface to display data from
I'm currently attempting to migrate a legacy VBA/Microsoft Access application to Python and PyQt.

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.