Im sure this sort of question has been asked to death and I understand what I should be doing, but its not working. My app is crashing:
Here's the code:
PDFViewController *cv = [[PDFViewController alloc] initWithNibName:@"PDFViewController" bundle:[NSBundle mainBundle]];
cv.view.frame = CGRectMake(0, 0, 1024, 748);
[self.view addSubview:cv.view];
Now, if I send a release message to the cv instance:
[cv release];
My application crashes. Same if I add it to the autorelease pool (on alloc/init). Now my concern is this:
0) I'm alloc/init'ing, so its my duty to release (or add to auto-release pool).
1) Calling addSubview:cv.view increments the retain count of the cv.
2) I should be able to send it a release message, because it's being retained by the self.view.
3) What's wrong?
TIA.
EDIT Solution
PDFViewController *cv = [[PDFViewController alloc] initWithNibName:@"PDFViewController" bundle:[NSBundle mainBundle]];
[self presentModalViewController:cv animated:YES];