Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS initializer parameter is nil
    primarykey
    data
    text
    <p>I'm fairly new to the iOS platform and I'm having some issues with the memory management. I'm passing an object (a Trial) in through an initializer of a custom UIViewController class and when the UIViewController finally receives it, the object is nil. I was hoping someone could point me in the right direction. I've included some of the source code below.</p> <p>Trial.h</p> <pre><code>@interface Trial : NSObject { NSString *IRBNumber; NSString *PI; NSString *Sponsor; NSString *ContactName; NSString *ContactPhone; NSString *ContactEmail; NSString *Location; NSString *Objective; NSString *Eligibility; NSString *Name; NSString *DiseaseGroup; NSString *Age; } @property (retain, nonatomic) NSString *IRBNumber; @property (retain, nonatomic) NSString *PI; @property (retain, nonatomic) NSString *Sponsor; @property (retain, nonatomic) NSString *ContactName; @property (retain, nonatomic) NSString *ContactEmail; @property (retain, nonatomic) NSString *ContactPhone; @property (retain, nonatomic) NSString *Location; @property (retain, nonatomic) NSString *Objective; @property (retain, nonatomic) NSString *Eligibility; @property (retain, nonatomic) NSString *Name; @property (retain, nonatomic) NSString *DiseaseGroup; @property (retain, nonatomic) NSString *Age; @end </code></pre> <p>DiseaseControllersViewController.m</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { Trial *trial = (Trial *)[dataArray objectAtIndex:indexPath.row]; TrialDetailController *detailViewController = [[TrialDetailController alloc] initWithNibNameAndTrial:@"TrialDetailController" bundle:nil trial:trial]; [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release]; [trial release]; } </code></pre> <p>Here's the definition of the initializer</p> <pre><code>-(id)initWithNibNameAndTrial: (NSString*)NibNameOrNil bundle:(NSBundle*)nibBundlerOrNil trial:(Trial *)inTrial { self = [super initWithNibName:NibNameOrNil bundle:nibBundlerOrNil]; if(self) { self.trial = inTrial; } return self; } </code></pre> <p>TrialDetailController.h</p> <pre><code>#import "Trial.h" @interface TrialDetailController : UITabBarController { Trial *trial; } @property (nonatomic, retain) Trial *trial; -(id)initWithNibNameAndTrial: (NSString*)NibNameOrNil bundle:(NSBundle*)nibBundlerOrNil trial:(Trial *)inTrial; -(IBAction)objectiveTabItemClick:(id)sender; -(IBAction)detailsTabItemClick:(id)sender; @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.
 

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