Please someone look at this post!


I have pretty much copied the code word for word and I when I click on an item it moves to the next screen and nothing appears only UINavigation bar and the camera icon. When I press the camera icon I get a “SIBART Error”. It does not give me any clues as to what is wrong. I am even considering skipping this chapter and moving on.
This is my ItemDetailedViewController h file

[code]#import <UIKit/UIKit.h>
@class Possession;
@interface ItemDetailViewController : UIViewController
IBOutlet UITextField *nameField;
IBOutlet UITextField *serialNumberField;
IBOutlet UITextField *valueField;
IBOutlet UILabel *dateLabel;
Possession *editingPossession;
IBOutlet UIImageView *imageView;
@property (nonatomic,assign)Possession *editingPossession;

  • (IBAction)takePicture:(id)sender;
  • (IBAction)backgroundTapped:(id)sender;

and the ItemDetailedViewController.m file

[code]#import “ItemDetailViewController.h”
#import “Possession.h”
#import “ImageCache.h”

@implementation ItemDetailViewController
@synthesize editingPossession;

UIImagePickerController *imagePicker=[[UIImagePickerController alloc]init];
//if our device has a camera we want to take a picture, otherwise, we just pick from photo album
if ([UIImagePickerController
isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
//image picker needs a delegate so we can respond to its messages
[imagePicker setDelegate:self];
//place image on the screen
[self presentModalViewController:imagePicker animated:YES];
//The image picker will be retained by ItemDetailedViewController
//until it has been dismissed
[imagePicker release];
[[self view] endEditing:YES];

[super initWithNibName:@“ItemDetailViewController” bundle:nil];
//Create a UIBarButtonItem with a camera icon, will send
//takePicture to our ItemDetailViewController when tapped
UIBarButtonItem *camerBarButtonItem=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:@selector(takePicture)];
//Place this image on our navigation bar whe this viewcontroller
//is on top of the navigation stack
[[self navigationItem]setRightBarButtonItem:camerBarButtonItem];
//cameraBarButton is retained by the navigation item
[camerBarButtonItem release];
return self;


  • (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

    return [self init];
    [super viewWillAppear];
    [nameField setText:[editingPossession possessionName]];
    [serialNumberField setText:[editingPossession serialNumber]];
    [valueField setText:[NSString stringWithFormat:@"%d",[editingPossession valueInDollars]]];
    //Create a NSDateFormatter that will turn a date into a simple date string
    NSDateFormatter *dateFormatter=[[[NSDateFormatter alloc]init]autorelease];
    [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
    [dateFormatter setTimeStyle:NSDateFormatterNoStyle];
    //Use filtered NSDate object to set dateLabel contents
    [dateLabel setText:[dateFormatter stringFromDate:[editingPossession dateCreated]]];
    //Change the navigation item to display name of possession
    [[self navigationItem]setTitle:[editingPossession possessionName]];

  • (void)didReceiveMemoryWarning
    // Releases the view if it doesn’t have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren’t in use.

#pragma mark - View lifecycle

  • (void)viewDidLoad
    [super viewDidLoad];
    [[self view]setBackgroundColor:[UIColor groupTableViewBackgroundColor]];

  • (void)viewDidUnload
    [super viewDidUnload];
    [nameField release];
    nameField= nil;
    [serialNumberField release];
    serialNumberField = nil;
    [valueField release];
    [dateLabel release];
    dateLabel = nil;
    [imageView release];
    imageView= nil;
    [nameField release];
    [serialNumberField release];
    [valueField release];
    [dateLabel release];
    [imageView release];
    [super dealloc];

  • (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
    //Clear first responder
    [nameField resignFirstResponder];
    [serialNumberField resignFirstResponder];
    [valueField resignFirstResponder];
    //“Save” changes to editingPossession
    [editingPossession setPossessionName:[nameField text]];
    [editingPossession setPossessionName:[serialNumberField text]];
    [editingPossession setValueInDollars:[[valueField text]intValue]];
    -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    //get picked image from info dictionary
    UIImage *image=[info objectForKey:UIImagePickerControllerOriginalImage];
    //Put that image onto the screen in our image view

    //take image picker of the screen
    //you must call this dismiss method
    [self dismissModalViewControllerAnimated:YES];
    [imageView setImage:image];