There are two documented exceptions thrown by replaceObjectAtIndex. One results from withObject being nil; in your case that is unlikely. The other is that the index exceeds the bounds of the array: are you sure there is at least one pre-existing object in the array?
To properly create a property with code (that is, not a UI control from Interface Builder) in "init" method, *always* retain your property.
myNSMutableArray = [[NSMutableArray alloc] initWith....];
should be
myNSMutableArray = [[[NSMutableArray alloc] initWith....] retain];
This is totally incorrect, alloc automatically retains as do methods with new or copy in them. The connivence class methods return a retained and autoreleased item and need to be retained it need be.
When you see the TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION message there is more info in the Xcode Debugger Console. Open up the console window and look for the kind of exception. As mentioned upthread there are different kinds of exceptions. Looking at the kind of exception will help you to figure out the problem. You can also see the NSLog output in Console.app.
Also, by the time the app is terminated due to the uncaught exception there is no useful backtrace. If you set a breakpoint on objc_exception_throw the debugger will break before the exception is thrown and you'll have a useful backtrace. I do this with a .gdbinit file. Create a file named .gdbinit and place it in your home directory. This is the contents of mine:
It's also possible to set these kinds of breakpoints in the Xcode breakpoints window or in the debugger console.
At any rate, the usual reason for an exception with replaceObjectAtIndex is out of range. Another reason is that your instance variable has already been released due to faulty memory management so you message a stale pointer.
what if you want to replace one instance IN the object?
if object1 at index 0 has 2 keys: firstname lastname;
how would I replace the lastname Without touching the firstname? can you get that granular with an array? or do you have to write the entire array every change? doesnt this create a lot of overhead?