How can i get the date out of my completion handler.

Discussion in 'iOS Programming' started by thangiavel, Sep 12, 2011.

  1. thangiavel, Sep 12, 2011
    Last edited by a moderator: Sep 12, 2011

    thangiavel macrumors newbie

    Sep 5, 2011
    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 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..........
  2. ChOas, Sep 12, 2011
    Last edited: Sep 12, 2011

    ChOas macrumors regular

    Nov 24, 2006
    The Netherlands
    Is it the space between imgData and .date ?
  3. ianray macrumors 6502

    Jun 22, 2010
    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 :)
  4. jiminaus macrumors 65816


    Dec 16, 2010
    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.
  5. thangiavel thread starter macrumors newbie

    Sep 5, 2011

Share This Page