0

UIStoryboardSegue, NSException App has storyboard with around 25 viewControllers. All segues work except this one. This is with Mavericks and Xcode 5.1

App terminates with an Exception:

2014-05-15 21:16:17.004 iHungryMePlus[18768:60b] -[EditRecipeViewController viewDidLoad] 
2014-05-15 21:16:17.060 iHungryMePlus[18768:60b] -[EditRecipeViewController viewWillAppear:]     [[self tableView] isEditing]=1
2014-05-15 21:16:17.257 iHungryMePlus[18768:60b] -[EditRecipeViewController tableviewCellWithReuseIdentifier:] cell for Photo reuse = <UITableViewCell: 0x1770fd30; frame = (0 0; 320 44); layer = <CALayer: 0x1770fec0>> 
2014-05-15 21:16:42.804 iHungryMePlus[18768:60b] -[EditRecipeViewController tableView:cellForRowAtIndexPath:] created cell for Photo = <UITableViewCell: 0x1770fd30; frame = (0 0; 320 44); layer = <CALayer: 0x1770fec0>> 
2014-05-15 21:16:42.858 iHungryMePlus[18768:60b] -[EditRecipeViewController tableView:cellForRowAtIndexPath:] created cell for Photo = <UITableViewCell: 0x17713f60; frame = (0 0; 320 44); layer = <CALayer: 0x17713ef0>>
2014-05-15 21:16:42.863 iHungryMePlus[18768:60b] -[EditRecipeViewController configureCell:forIndexPath:] indexPath=<NSIndexPath: 0x175d96a0> {length = 2, path = 5 - 1}
2014-05-15 21:16:56.577 iHungryMePlus[18768:60b] TOP prepareForSegue: EDIT_RECIPE_ADDPHOTO
2014-05-15 21:16:56.616 iHungryMePlus[18768:60b] new unique id ='IHM-18768-0BBD0DF4-F19E-4C88-AFD0-415E5EA01D96'
2014-05-15 21:17:05.017 iHungryMePlus[18768:60b] -[EditRecipeViewController prepareForSegue:sender:] End EDIT_RECIPE_ADDPHOTO Prepare
2014-05-15 21:17:10.150 iHungryMePlus[18768:60b] -[AddPhotoViewController viewDidLoad] 
2014-05-15 21:17:12.794 iHungryMePlus[18768:60b] -[AddPhotoViewController viewWillAppear:] 
2014-05-15 21:40:10.604 iHungryMePlus[18768:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x2e446fd3 0x38b8fccf 0x2e380f9d 0x30cf9c6f 0x30cf9aab 0x30cf9633 0x30d10f49 0x30d10b8d 0x30d10b25 0x30c62d79 0x308e062b 0x308dbe3b 0x308dbccd 0x308db6df 0x308db4ef 0x308d521d 0x2e4122a5 0x2e40fc49 0x2e40ff8b 0x2e37af4f 0x2e37ad33 0x3329c663 0x30cc616d 0xb6015 0x3909cab7)
libc++abi.dylib: terminating with uncaught exception of type NSException

This exception indicates that a nil object was added to the an NSArray.

There is a push segue from EditRecipeViewController to AddPhotoViewController, with segue identifier:EDIT_RECIPE_ADDPHOTO There is an NSLog at the top of every method in AddPhotoVC. Only two are printed before the Exception.

  1. from viewDidLoad
  2. from viewWillAppear:

The segue is attempted using in EditRecipeViewController:

[self performSegueWithIdentifier:@"EDIT_RECIPE_ADDPHOTO" sender:indexPath];

followed by this code in -prepareSegue:sender:

else if([segue.identifier isEqualToString:@"EDIT_RECIPE_ADDPHOTO"]){
        AddPhotoViewController *destCntrlr = (AddPhotoViewController*)segue.destinationViewController;
        Photo* aPhoto = [NSEntityDescription insertNewObjectForEntityForName:@"Photo" inManagedObjectContext:self.recipe.managedObjectContext]; //INSERT MO
        [self setPhoto:aPhoto];
        DLog(@"INSERT:self.photo=%@",self.photo);
            //NEED indexPath NOW
        NSIndexPath *indexPath= (NSIndexPath *)sender;
        [[self photo] setSortIndex:[NSNumber numberWithInt:indexPath.row]];
        NSString* stockName = [NSString stringWithFormat:@"Photo #%u", [indexPath indexAtPosition:1] + 1];
        [[self photo] setName:stockName];
        [[self photo] setModified:[NSDate date]];
        [[ self photo] setUid:[Photo calculateNewUniqueID]];
        [destCntrlr setPhoto:aPhoto];
        [destCntrlr setDelegate:self]; 
        [destCntrlr setRecipe:[self recipe]];
        DLog(@"End EDIT_RECIPE_ADDPHOTO Prepare");
}

The AddPhoto View never appears. If I check the box for AddRecipe initial scene [ ] is the initial View Controller, then the view displays correctly at startup. I can also make the AddPhoto view appear using a NIB file. I can also put up the AddPhotoViewController using:

UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"AddPhotoID"];
[self presentViewController:vc animated:YES completion:nil];

What have I done to track down a solution to this storyboard/segue problem ?

  • check for instances in my code of [insertObject:atIndex:]
  • set All Exception break point , on throw
  • set All Exception break point , on catch
  • set Symbolic Break point for [NSArrary insertObject:atIndex:] for All modules

I expect these Breakpoints to stop the app and display a stack that I can go through to find the problem. I only see:

https://www.dropbox.com/s/rhiz7g2792xu4nt/Screenshot%202014-05-16%2022.39.07.png

I can not find log messages that help me track down the solution to this exception. I view the Debug Log, but find no more helpful reference to the Exception. At the end, I see only what I list above. Can you please help me?

Many Thanks for reading, Mark

This is additional info below.

Paulw11 and Ricky, I really want to thank you for your suggestions!

The property 'photo' in the destination view is:

@property(nonatomic, strong) Photo* photo;

I searched (Contains, Ignoring Case For: array) the entire destinationController implementation file, namely AddPhotoViewController.m. No results where found in this search.

I found the following answer to a similar problem at SO.

This is a fairly common error and it has three causes:

Misspelling the entity name e.g. NewsStand instead of NewsStands.
Having a nil managed object context
Having no or the wrong managed object model loaded.
(1) is the most common but (3) is more common than (2). You can check that you are loading the right model with the keypath:

aManagedObjectContext.persistentStoreCoordinator.managedObjectModel.entities
then check the entity's names.

AddPhotoViewController has no ivar for either NSManagedObjectContext or NSManagedObjectModel. The entity name is spelled correctly, "Photo".

I set the following Break Points:

set All Exception break point , on catch set All Exception break point , on throw set Symbolic Break point for [NSArrary insertObject:atIndex:] for All modules

At the end of -viewWillAppear the stack is this way:

https://www.dropbox.com/s/ykmv1qsdnm3trbp/Screenshot%202014-05-20%2016.21.44.png

I then click continue and the stack looks this way

https://www.dropbox.com/s/ladjxsfyafm0opu/Screenshot%202014-05-20%2016.04.43.png

I click continue a second time and stack shows:

https://www.dropbox.com/s/tvcvh4tvd0as5wl/Screenshot%202014-05-20%2016.08.16.png

Click continue a third time stack is now:

https://www.dropbox.com/s/cuqd4qa9j249vxx/Screenshot%202014-05-20%2016.09.34.png

SubListViewController : -prepareForSegue:sender: has

if([segue.identifier isEqualToString:@"ADDRECIPE"]) {
      AddRecipeViewController  *destCntrlr = (AddRecipeViewController*)segue.destinationViewController;
      [destCntrlr setDelegate:self]; //create and set delegate
      CoreDataHelper *cdh = [CoreDataHelper sharedHelper];

      [cdh.context.undoManager beginUndoGrouping];//AddRx L:0

      Recipe *aRecipe =
      [NSEntityDescription insertNewObjectForEntityForName:@"Recipe"
                                    inManagedObjectContext:[self.frc managedObjectContext]];
         // Recipe object created but still needs to be named.
         // naming is done in NameRecipeViewController, which is reached
         // from the AddRecipeViewController

      DLog(@"aRecipe=%@",aRecipe);
      [aRecipe setUid:[Photo calculateNewUniqueID]];
      [aRecipe setModified:[NSDate date]]; //creation date

      destCntrlr.recipe = aRecipe;
      [destCntrlr setSubListViewController:self];
      [destCntrlr setAppDelegate:self.appDelegate];//necessary??
      [destCntrlr setDelegate:self];

   }

//
//  AddPhotoViewController.m
//  iHungryMePlus
//

#import "AddPhotoViewController.h"
#import "AddPhotoTitleViewController.h"
#import "CoreDataHelper.h"
////#ifdef ICLOUD
   //#import "SVProgressHUD.h"
////#endif

@implementation AddPhotoViewController
@synthesize cancelButton, doneButton;
@synthesize image,imageView;
@synthesize recipe;
@synthesize grabPhotoButton;
@synthesize addTitleButton;
@synthesize titleLabel;
@synthesize recipePhotoDx;
@synthesize photo;
@synthesize delegate;
@synthesize navigationItem , navigationBar;
@synthesize  isEditing;
@synthesize loadFailedLabel;
@synthesize activityIndicatorView;

@synthesize cameraLibrarySegment;
@synthesize cameraSelected;
//@synthesize myPopover;


#pragma mark PopupPassData protocol

// deleting some method //

#pragma mark VIEW Observer

- (void)observeValueForKeyPath:(NSString *)keyPath
                      ofObject:(id)object
                        change:(NSDictionary *)change
                       context:(void *)context {

   if ([keyPath isEqualToString:@"self.imageView.image"]) {
      [self.doneButton setEnabled: self.imageView.image != nil];
      [[self loadFailedLabel] setHidden:(BOOL)([[self imageView] image] != nil)];
   }
}

#pragma mark VIEW

- (void)viewDidLoad {
   DLog(@"");
   [super viewDidLoad];

    [[self doneButton] setEnabled:NO];
   self.cameraSelected=YES;

   [[self loadFailedLabel] setHidden:NO];

   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleLowMemoryNotification:)
            name:UIApplicationDidReceiveMemoryWarningNotification object:nil];

   [self addObserver:self
                      forKeyPath:@"self.imageView.image"
                         options:NSKeyValueObservingOptionNew
                         context:NULL];

}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
   DLog(@"Top");

    // after picking image this runs and then later the picker Delegate didFinishPickingMediaWithInfo: Moving to DidAppear:
    [[self addTitleButton] setHidden:NO];
    [[self titleLabel] setText:[photo name]];
    if([photo image]){
       [[self imageView] setImage:[UIImage imageWithData:[photo image ]]];
    }else if([[photo filename ]length]){
       [[self imageView] setImage:[UIImage imageNamed:[photo filename]]];
    }
   DLog(@"Final line in viewWillAppear.");
}

- (void)viewDidAppear:(BOOL) animated{
   [super viewDidAppear:animated];

   if(![self isEditing])
        [[self navigationItem] setTitle:@"Add Photo"];//insert
    else {
        [[self navigationItem] setTitle:@"Edit Photo"];
    }
      //[[self navigationItem] setTitle:([self isEditing] ? @"Edit Photo" : @"Add Photo" )];
   [[self cancelButton] setEnabled:YES];

   DLog(@"Final line in viewDidAppear.");
}

- (void)viewWillDisappear:(BOOL)animated {
   [super viewWillDisappear:animated];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];

   [[self imageView] setImage:nil];
}

- (void)viewDidUnload {
      // Release any retained subviews of the main view.
      // e.g. self.myOutlet = nil;
   [self removeObserver:self forKeyPath:@"self.imageView.image"];

}

- (IBAction)grabPhotoAction
{
    UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
    //  Create a popover, add the picker as the content view controller....viola.
    imagePicker.delegate = self; //UIImagePickerControllerSourceTypeCamera
                                //UIImagePickerControllerSourceTypePhotoLibrary
    imagePicker.sourceType = (cameraSelected) ?
      UIImagePickerControllerSourceTypeCamera : UIImagePickerControllerSourceTypePhotoLibrary;

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        Class classPopoverController = NSClassFromString(@"UIPopoverController"); 
        if (classPopoverController) {   // 3.2 or higher
         /*
            myPopover = [[classPopoverController alloc] initWithContentViewController:anImagePickerController];
            [myPopover presentPopoverFromRect:CGRectMake(419, 880, 127, 38)
                                                            inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
            [(UIPopoverController*)popoverController setDelegate:self];
            // Store the popover in a custom property for later use.
            //[self setPopoverController:aPopoverController];
            */
        }
    }else {
         [self presentViewController:imagePicker animated:YES completion:NULL];
         //[self performSegueWithIdentifier:@"GrabPhoto" sender:self];
    }
      //#endif

}

- (IBAction)addTitleAction {//add or edit

      [self performSegueWithIdentifier:@"PHOTOTITLE" sender:self];
      //[self presentViewController:self.addPhotoTitleViewController animated:YES completion:NULL];
}


#pragma mark SEGUE

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{

    NSLog(@"prepareForSegue: %@", segue.identifier);
   if([segue.identifier isEqualToString:@"PHOTOTITLE"]) {
      AddPhotoTitleViewController *destCntrlr = (AddPhotoTitleViewController*)segue.destinationViewController;
      [destCntrlr setIsEditing:[self isEditing]];
         //[destCntrlr setParentDoneBarButton:doneButton];
      [destCntrlr setPhoto:photo];
      [destCntrlr setTitleParentLabel:[self titleLabel]];
      [destCntrlr setRecipe :[self recipe]];
   }
   else {
      DLog(@"Can not find segue where segue.identifier=%@",segue.identifier);
   }
}


#pragma mark UITextFieldDelegate

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    //[[self titleTextField] resignFirstResponder];
    return YES;
}

   // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
#pragma mark Orientation delegate methods

- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}

strong text @end

ENDS:

Click Continue a fourth and a fifth time and we see at last the Exception reported

2014-05-20 16:10:22.374 iHungryMePlus[25337:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSArrayM insertObject:atIndex:]: object cannot be nil' * First throw call stack: (0x2e446fd3 0x38b8fccf 0x2e380f9d 0x30cf9c6f 0x30cf9aab 0x30cf9633 0x30d10f49 0x30d10b8d 0x30d10b25 0x30c62d79 0x308e062b 0x308dbe3b 0x308dbccd 0x308db6df 0x308db4ef 0x308d521d 0x2e4122a5 0x2e40fc49 0x2e40ff8b 0x2e37af4f 0x2e37ad33 0x3329c663 0x30cc616d 0x13959d 0x3909cab7) libc++abi.dylib: terminating with uncaught exception of type NSException

The stack after this fifth Continue is :

https://www.dropbox.com/s/jjyuz0kjxgy7qnr/Screenshot%202014-05-20%2016.12.24.png

Entire Debug Log Follows:

The flow of the code outline is:

1. Home (RootTableViewController) TV shows list of Recipe categories.
2. Selection of category on RTVC -> display SubListViewController (list of Rxs for the category)
3. Touch Edit button to reach Edit Recipe Mode, which includes display of '+' button to reach
AddRecipeVC. 
4. User is force to enter Name of Rx before proceeding.
5. I then touch Add Photo button -> (AddPhotoVC) for this new Recipe object and the problems ensue.

iHungryMePlus(25395,0x3b0e518c) malloc: stack logs being written into /tmp/stack-logs.25395.1b5000.iHungryMePlus.Hr5XtA.index
iHungryMePlus(25395,0x3b0e518c) malloc: recording malloc and VM allocation stacks to disk using standard recorder
iHungryMePlus(25395,0x3b0e518c) malloc: process 25370 no longer exists, stack logs deleted from /tmp/stack-logs.25370.108000.iHungryMePlus.ZicUAe.index
2014-05-20 16:19:39.611 iHungryMePlus[25395:60b] -[iHungry_MeAppDelegate application:didFinishLaunchingWithOptions:] 
Bundle bundleVer=4.5.0
defaultsVer=4.5.0
2014-05-20 16:19:39.623 iHungryMePlus[25395:60b] -[iHungry_MeAppDelegate applicationDocumentsDirectoryPath] Running iHungry_MeAppDelegate 'applicationDocumentsDirectoryPath'
/var/mobile/Applications/CF17E960-FA49-425A-91ED-1F76A845E8A3/Documents
2014-05-20 16:19:39.628 iHungryMePlus[25395:60b] bICloudSupport=0
2014-05-20 16:19:39.632 iHungryMePlus[25395:60b] -[iHungry_MeAppDelegate application:didFinishLaunchingWithOptions:] Bottom AppDelegate.
2014-05-20 16:19:39.718 iHungryMePlus[25395:60b] -[RootTableViewController viewDidLoad] 
2014-05-20 16:19:39.722 iHungryMePlus[25395:60b] -[RootTableViewController configureFetch] Running RootTableViewController 'configureFetch'
2014-05-20 16:19:39.779 iHungryMePlus[25395:60b] Running CoreDataHelper 'listenForStoreChanges'
2014-05-20 16:19:39.786 iHungryMePlus[25395:60b] ** iCloud is DISABLED in Settings **
2014-05-20 16:19:39.790 iHungryMePlus[25395:60b] Running CoreDataHelper 'setDefaultDataStoreAsInitialStore'
2014-05-20 16:19:39.828 iHungryMePlus[25395:60b] -[iHungry_MeAppDelegate applicationDocumentsDirectoryPath] Running iHungry_MeAppDelegate 'applicationDocumentsDirectoryPath'
/var/mobile/Applications/CF17E960-FA49-425A-91ED-1F76A845E8A3/Documents
2014-05-20 16:19:39.890 iHungryMePlus[25395:60b] -[iHungry_MeAppDelegate applicationDocumentsDirectoryPath] Running iHungry_MeAppDelegate 'applicationDocumentsDirectoryPath'
/var/mobile/Applications/CF17E960-FA49-425A-91ED-1F76A845E8A3/Documents
2014-05-20 16:19:39.898 iHungryMePlus[25395:60b] -[CoreDataHelper isMigrationNecessaryForStore:] storeUrl=file:///var/mobile/Applications/CF17E960-FA49-425A-91ED-1F76A845E8A3/Documents/Stores/IHM_Recipes.sqlite
2014-05-20 16:19:39.929 iHungryMePlus[25395:60b] SKIPPED MIGRATION: Source is already compatible
2014-05-20 16:19:39.934 iHungryMePlus[25395:60b] -[iHungry_MeAppDelegate applicationDocumentsDirectoryPath] Running iHungry_MeAppDelegate 'applicationDocumentsDirectoryPath'
/var/mobile/Applications/CF17E960-FA49-425A-91ED-1F76A845E8A3/Documents
2014-05-20 16:19:39.987 iHungryMePlus[25395:60b] Running CoreDataHelper 'storesDidChange:'
2014-05-20 16:19:39.991 iHungryMePlus[25395:60b] -[CoreDataHelper storesDidChange:] responding to notification storesDidCh by posting SomethingChanged note.
2014-05-20 16:19:39.996 iHungryMePlus[25395:60b] Successfully added store: <NSSQLCore: 0x1659ad60> (URL: file:///var/mobile/Applications/CF17E960-FA49-425A-91ED-1F76A845E8A3/Documents/Stores/IHM_Recipes.sqlite)
2014-05-20 16:19:40.004 iHungryMePlus[25395:60b] ** iCloud is DISABLED in Settings **
2014-05-20 16:19:40.015 iHungryMePlus[25395:60b] -[RootTableViewController numberOfSectionsInTableView:] sectionCnt=0
2014-05-20 16:19:40.019 iHungryMePlus[25395:60b] -[RootTableViewController numberOfSectionsInTableView:] sectionCnt=0
2014-05-20 16:19:40.062 iHungryMePlus[25395:60b] -[CoreDataTVC performFetch] 
2014-05-20 16:19:40.067 iHungryMePlus[25395:60b] -[CoreDataTVC performFetch] RTVC
2014-05-20 16:19:40.113 iHungryMePlus[25395:60b] -[RootTableViewController numberOfSectionsInTableView:] sectionCnt=6
2014-05-20 16:19:40.118 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 5 Cnt=2
2014-05-20 16:19:40.123 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 0 Cnt=1
2014-05-20 16:19:40.128 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 1 Cnt=1
2014-05-20 16:19:40.133 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 2 Cnt=1
2014-05-20 16:19:40.138 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 3 Cnt=3
2014-05-20 16:19:40.143 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 4 Cnt=1
2014-05-20 16:19:40.185 iHungryMePlus[25395:60b] __27-[CoreDataTVC performFetch]_block_invoke reloadData completed
2014-05-20 16:19:40.189 iHungryMePlus[25395:60b] -[RootTableViewController viewWillAppear:] doDisplayHUD=0
2014-05-20 16:19:40.194 iHungryMePlus[25395:60b] ** iCloud is DISABLED in Settings **
2014-05-20 16:19:40.219 iHungryMePlus[25395:60b] -[RootTableViewController numberOfSectionsInTableView:] sectionCnt=6
2014-05-20 16:19:40.224 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 5 Cnt=2
2014-05-20 16:19:40.229 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 0 Cnt=1
2014-05-20 16:19:40.233 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 1 Cnt=1
2014-05-20 16:19:40.238 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 2 Cnt=1
2014-05-20 16:19:40.243 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 3 Cnt=3
2014-05-20 16:19:40.247 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 4 Cnt=1
2014-05-20 16:19:40.368 iHungryMePlus[25395:60b] -[iHungry_MeAppDelegate applicationDidBecomeActive:] 
2014-05-20 16:19:40.531 iHungryMePlus[25395:60b] -[RootTableViewController viewDidAppear:] Running RootTableViewController 'viewDidAppear:'
2014-05-20 16:20:40.097 iHungryMePlus[25395:60b] -[RootTableViewController tableView:didSelectRowAtIndexPath:] Category.name=Desserts
2014-05-20 16:20:40.109 iHungryMePlus[25395:60b] prepareForSegue: SLVC
2014-05-20 16:20:40.114 iHungryMePlus[25395:60b] -[RootTableViewController prepareForSegue:sender:] Selected category=Desserts
2014-05-20 16:20:40.150 iHungryMePlus[25395:60b] -[CoreDataTVC configureSearch] 
2014-05-20 16:20:40.164 iHungryMePlus[25395:60b] -[SubListViewController numberOfSectionsInTableView:] 
2014-05-20 16:20:40.372 iHungryMePlus[25395:60b] -[SubListViewController numberOfSectionsInTableView:] 
2014-05-20 16:20:40.397 iHungryMePlus[25395:60b] -[SubListViewController configureFetch] Running SubListViewController 'configureFetch'
2014-05-20 16:20:40.403 iHungryMePlus[25395:60b] -[CoreDataTVC performFetch] 
2014-05-20 16:20:40.407 iHungryMePlus[25395:60b] -[CoreDataTVC performFetch] SLVC
2014-05-20 16:20:40.461 iHungryMePlus[25395:60b] -[SubListViewController numberOfSectionsInTableView:] 
2014-05-20 16:20:40.504 iHungryMePlus[25395:60b] __27-[CoreDataTVC performFetch]_block_invoke reloadData completed
2014-05-20 16:20:40.511 iHungryMePlus[25395:60b] ** iCloud is DISABLED in Settings **
2014-05-20 16:20:40.519 iHungryMePlus[25395:60b] -[SubListViewController viewWillAppear:] [[self.frc fetchedObjects] count]=12
2014-05-20 16:20:40.524 iHungryMePlus[25395:60b] -[SubListViewController viewWillAppear:] @ self.motionManager.deviceMotionActive=0
2014-05-20 16:20:40.531 iHungryMePlus[25395:60b] -[SubListViewController numberOfSectionsInTableView:] 
2014-05-20 16:20:41.302 iHungryMePlus[25395:60b] -[SubListViewController viewDidAppear:] Running SubListViewController 'viewDidAppear:'
2014-05-20 16:20:41.309 iHungryMePlus[25395:60b] ** iCloud is DISABLED in Settings **
2014-05-20 16:20:44.528 iHungryMePlus[25395:60b] -[SubListViewController numberOfSectionsInTableView:] 
2014-05-20 16:20:46.164 iHungryMePlus[25395:60b] prepareForSegue: ADDRECIPE
2014-05-20 16:20:46.189 iHungryMePlus[25395:60b] -[SubListViewController prepareForSegue:sender:] aRecipe=<Recipe: 0x166f22a0> (entity: Recipe; id: 0x166f3760 <x-coredata:///Recipe/tEC40BCE6-61A1-45D2-B092-0A69DEB101D42> ; data: {
    categories =     (
    );
    comments = nil;
    ctime = 0;
    directions = nil;
    firstLetter = nil;
    ingredients = nil;
    modified = "1970-01-01 12:00:00 +0000";
    name = nil;
    nameShort = nil;
    photos =     (
    );
    ptime = 0;
    recipeID = 0;
    uid = nil;
})
2014-05-20 16:20:46.194 iHungryMePlus[25395:60b] new unique id ='IHM-25395-0DD78F88-E819-43B4-9012-02DB9FDE8301'
2014-05-20 16:20:52.791 iHungryMePlus[25395:60b] -[AddRecipeViewController prepareForSegue:sender:] segue.identifier:NAMERECIPE
2014-05-20 16:20:52.795 iHungryMePlus[25395:60b] -[AddRecipeViewController prepareForSegue:sender:] nameRecipeViewController=<NameRecipeViewController: 0x1663a350>
2014-05-20 16:20:55.583 iHungryMePlus[25395:60b] -[NameRecipeViewController textField:shouldChangeCharactersInRange:replacementString:]  editLengthB4 = 0
 range.length =0
 replaceStrLen=1
2014-05-20 16:20:55.587 iHungryMePlus[25395:60b] -[NameRecipeViewController textField:shouldChangeCharactersInRange:replacementString:] Length=1
2014-05-20 16:20:56.015 iHungryMePlus[25395:60b] -[NameRecipeViewController textField:shouldChangeCharactersInRange:replacementString:]  editLengthB4 = 1
 range.length =0
 replaceStrLen=1
2014-05-20 16:20:56.019 iHungryMePlus[25395:60b] -[NameRecipeViewController textField:shouldChangeCharactersInRange:replacementString:] Length=2
2014-05-20 16:20:56.365 iHungryMePlus[25395:60b] -[NameRecipeViewController textField:shouldChangeCharactersInRange:replacementString:]  editLengthB4 = 2
 range.length =0
 replaceStrLen=1
2014-05-20 16:20:56.369 iHungryMePlus[25395:60b] -[NameRecipeViewController textField:shouldChangeCharactersInRange:replacementString:] Length=3
2014-05-20 16:20:57.837 iHungryMePlus[25395:60b] -[AddRecipeViewController tableviewCellWithReuseIdentifier:] Add Photo cell for Photo reuse = <UITableViewCell: 0x167c0590; frame = (0 0; 320 44); layer = <CALayer: 0x167c0720>> 
2014-05-20 16:20:57.844 iHungryMePlus[25395:60b] -[AddRecipeViewController configureCell:forIndexPath:] indexPath=<NSIndexPath: 0x167c0580> {length = 2, path = 5 - 0}
2014-05-20 16:20:57.850 iHungryMePlus[25395:60b] -[AddRecipeViewController configureCell:forIndexPath:] cell=<UITableViewCell: 0x167c0590; frame = (0 0; 320 44); text = 'add photo'; layer = <CALayer: 0x167c0720>>
2014-05-20 16:20:57.985 iHungryMePlus[25395:60b] -[CoreDataTVC controllerWillChangeContent:] 
2014-05-20 16:20:57.989 iHungryMePlus[25395:60b] -[CoreDataTVC controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:] 
2014-05-20 16:20:57.993 iHungryMePlus[25395:60b] -[CoreDataTVC controllerDidChangeContent:] 
2014-05-20 16:20:57.997 iHungryMePlus[25395:60b] -[RootTableViewController numberOfSectionsInTableView:] sectionCnt=6
2014-05-20 16:20:58.001 iHungryMePlus[25395:60b] -[RootTableViewController numberOfSectionsInTableView:] sectionCnt=6
2014-05-20 16:20:58.005 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 0 Cnt=1
2014-05-20 16:20:58.009 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 1 Cnt=1
2014-05-20 16:20:58.013 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 2 Cnt=1
2014-05-20 16:20:58.016 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 3 Cnt=3
2014-05-20 16:20:58.021 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 4 Cnt=1
2014-05-20 16:20:58.029 iHungryMePlus[25395:60b] -[RootTableViewController tableView:numberOfRowsInSection:] rowsInSection 5 Cnt=2
2014-05-20 16:21:16.090 iHungryMePlus[25395:60b] -[AddRecipeViewController prepareForSegue:sender:] segue.identifier:ADDPHOTO
2014-05-20 16:21:16.093 iHungryMePlus[25395:60b] -[AddRecipeViewController prepareForSegue:sender:] beginUndoGrouping]; //AddRx.AddPhoto L:1
2014-05-20 16:21:16.103 iHungryMePlus[25395:60b] new unique id ='IHM-25395-5B4352A6-D3BB-4922-A1CF-008B388CA3C3'
2014-05-20 16:21:16.144 iHungryMePlus[25395:60b] -[AddPhotoViewController viewDidLoad] 
2014-05-20 16:21:20.907 iHungryMePlus[25395:60b] -[AddPhotoViewController viewWillAppear:] Top
2014-05-20 16:22:32.161 iHungryMePlus[25395:60b] -[AddPhotoViewController viewWillAppear:] Final line in viewWillAppear.
2014-05-20 16:22:40.087 iHungryMePlus[25395:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x2e446fd3 0x38b8fccf 0x2e380f9d 0x30cf9c6f 0x30cf9aab 0x30cf9633 0x30d10f49 0x30d10b8d 0x30d10b25 0x30c62d79 0x308e062b 0x308dbe3b 0x308dbccd 0x308db6df 0x308db4ef 0x30c66401 0x2e41225b 0x2e41172b 0x2e40ff1f 0x2e37af4f 0x2e37ad33 0x3329c663 0x30cc616d 0x13a775 0x3909cab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
mbarron
  • 285
  • 4
  • 15
  • 5
    Your log shows that you have ended `prepareForSegue` and you have executed `viewWillAppear` in your destination view controller, so none of the code you have provided is likely to be directly relevant to the exception. You need to be looking at array manipulations in your destination view controller. How are the properties on your destination controller declared - particularly `aPhoto` ? This is a local variable in `prepareForSegue`, so if your destination is `weak` you will end up with nil – Paulw11 May 17 '14 at 03:49
  • Agree with Paulw11, it is definitely related to Array. – Ricky May 17 '14 at 04:23

1 Answers1

0

I stupidly added a NavigationItem to my ViewController !

I learned of this out by turning it into a TSI at Apple Developer Tech Support.

The tech wrote:

Remove this line from AddPhotoViewController.h

@property(nonatomic, retain) UINavigationItem* navigationItem;

as well as this line from AddPhotoViewController.m

@synthesize navigationItem;

so that your view controller again inherits the standard behavior.

mbarron
  • 285
  • 4
  • 15