Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

thangiavel

macrumors newbie
Original poster
Sep 5, 2011
13
0
Code:
ImagePicker *imgPic =[[ImagePicker alloc] initWithCompletionHandler:^(UIImage *image, NSString *name,NSDate* date) {
		ImageData *imgData =[[ImageData alloc]init];
		imgData.image =image;
		imgData.title =name;
		imgData .date = date ;
		[arrayForObjects insertObject:imgData atIndex:0];
		[imagesTable reloadData];

when i try to assign my date to imgData.date it crashes with the message EXC_BAD ACCESS.....

actually wats wrong with the code.......please help me anyone......helps will be appriciated...pls help me to do the thing..........
 
Last edited by a moderator:

ChOas

macrumors regular
Nov 24, 2006
139
0
The Netherlands
Code:
ImagePicker *imgPic =[[ImagePicker alloc] initWithCompletionHandler:^(UIImage *image, NSString *name,NSDate* date) {
		ImageData *imgData =[[ImageData alloc]init];
		imgData.image =image;
		imgData.title =name;
		imgData .date = date ;
		[arrayForObjects insertObject:imgData atIndex:0];
		[imagesTable reloadData];

when i try to assign my date to imgData.date it crashes with the message EXC_BAD ACCESS.....

actually wats wrong with the code.......please help me anyone......helps will be appriciated...pls help me to do the thing..........

Is it the space between imgData and .date ?
 
Last edited:

ianray

macrumors 6502
Jun 22, 2010
452
0
@
when i try to assign my date to imgData.date it crashes with the message EXC_BAD ACCESS.

Study the source and documentation for ImageData and ImagePicker in order to debug this. Questions that you might want to ask include:

  • Are you sure that the crash is at the assignment of date?
  • Is the block parameter "date" initialized? And if not, why not?
  • What data-type is the ImageData date property?

Good luck :)
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
It might also be helpful to put a breakpoint inside the handler and step through it. This should tell you which line is causing the EXC_BAD_ACCESS.

Sending a message to a released object is the most common cause of EXC_BAD_ACCESS. I suspect the problem is with either arrayForObjects or imagesTable.

Setting a property incorrectly or passing an invalid parameter is more likely to thrown an exception.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.