Re: Save dictionary to local file please help!

2009-05-12 Thread Michael Vannorsdel
You need to retain destinationPath when you create it so it doesn't go away. You properly retain dataDict, now do the same with destinationPath and you should be ok. Also you don't need to retain newRecord; the dictionary will retain it when you add it. On May 11, 2009, at 3:10 AM, Ben

Re: Save dictionary to local file please help!

2009-05-12 Thread Graham Cox
On 12/05/2009, at 6:55 PM, Michael Vannorsdel wrote: You properly retain dataDict, now do the same with destinationPath and you should be ok. On May 11, 2009, at 3:10 AM, Ben Spam wrote: if(!dataDict){ NSLog(@No File); dataDict = [[NSMutableDictionary alloc] init];} else{[dataDict

Save dictionary to local file please help!

2009-05-11 Thread Ben Spam
Please help me, I'm in serious trouble if I do not sort this out! I am trying to save a dictionary to a local file, but inserting a new record crashes my app and I can not fathom why, here is my code...please let me know if you see anything im doing wrong.. PS: the random key is purely for

Re: Save dictionary to local file please help!

2009-05-11 Thread Graham Cox
On 11/05/2009, at 7:10 PM, Ben Spam wrote: dataDict = [NSMutableDictionary dictionaryWithContentsOfFile:destinationPath]; You do not own dataDict after this line, so later access to it is accessing a stale pointer, and ...kablooey... it falls over. RTFDOMMA. (Read The Documentation