Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving the title of a button so it can be accessed in another view (Objective-C)
    primarykey
    data
    text
    <p>I'm trying to save the name of a button using a singleton so that the name can be accessed in another view to play a video with the same name. However, I'm getting the error: SIGABRT. I don't really see what's wrong with my code. Any ideas? </p> <pre><code>#import "List.h" #import "MyManager.h" #import "Video.h" @implementation ExerciseList -(IBAction) goToVideo:(UIButton *) sender{ MyManager *sharedManager = [MyManager sharedManager]; sharedManager.vidName = [[sender titleLabel] text]; Video *videoGo = [[Video alloc] initWithNibName: @"Video" bundle: nil]; [self.navigationController pushViewController: videoGo animated: YES]; [videoGo release]; } </code></pre> <p>Here is my .h and .m for MyManager:</p> <pre><code>#import &lt;foundation/Foundation.h&gt; @interface MyManager : NSObject { NSMutableArray *workouts; NSString *vidName; } @property (nonatomic, retain) NSMutableArray *workouts; @property (nonatomic, retain) NSString *vidName; + (id)sharedManager; @end #import "MyManager.h" static MyManager *sharedMyManager = nil; @implementation MyManager @synthesize workouts; @synthesize vidName; #pragma mark Singleton Methods + (id)sharedManager { @synchronized(self) { if (sharedMyManager == nil) sharedMyManager = [[self alloc] init]; } return sharedMyManager; } - (id)init { if ((self = [super init])) { workouts = [[NSMutableArray alloc] init]; vidName = [[NSString alloc] init]; } return self; } -(void) dealloc{ self.workouts = nil; self.vidName = nil; [super dealloc]; } @end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload