views:

70

answers:

1

I am using ABNewPersonViewController to add new contact to the address book. Every thing is fine if I do not add any photo from photo albums. It crashes if I add any photo and here is the log:-

NSInvalidArgumentException', reason: '*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: UIImagePickerControllerOriginalImage)

What I am doing wrong, or how I can fix this problem

Thanks

This is the code I use:

 mNewPersonViewController = [[[ABNewPersonViewController alloc]init]autorelease];
 mNewPersonViewController.hidesBottomBarWhenPushed = YES;
 mNewPersonViewController.addressBook = app.addressBook;
 mNewPersonViewController.newPersonViewDelegate = self;

 UINavigationController *presonNavController = [[UINavigationController alloc]initWithRootViewController:mNewPersonViewController];
 self.mPopOverController = [[UIPopoverController alloc]initWithContentViewController:presonNavController ];
 CGRect frame = [sender frame];
 [self.mPopOverController presentPopoverFromRect:frame inView:self.view permittedArrowDirections: UIPopoverArrowDirectionUp animated:YES];
 [presonNavController release];
A: 

Looks like you are trying to insert a nil value into the dictionary.

willcodejavaforfood
yea,I know as it is shown in log.But how can i fix this problem.since ABNewPersonViewController is address book framework class ,what i can do to fix this. thanks for your help.
vikas
I need to see the code where you add to the dictionary
willcodejavaforfood
I have initialize the ABNewPersonViewController and then initialize navigation controller with ABNewPersonViewController and then present the navigation controller inside the popover.
vikas