iphone - NSDictionary losing its contents (exc bad access) -


So I have a uiviewcontroller, it has a property of NSMutableArray, which maintains a non-basic, synthesized property.

DeodeLoad in view I put it in with the following, and also add a button in the NAV bar.

  test = [NSDictionary dictionaryWithObjectsAndKeys: [[SearchField alloc] initWithName: @ "subject": text], kSubjectKey, [[SearchField alloc] initWithName: @ "source publication": text], kSourceKey , [[SearchField alloc] initWithName: @ "keyword": text], kKeywordKey, [[SearchField alloc] initWithName: @ "author": text], kAuthorKey, [[SearchField alloc] initWithName: @ "color": boole] KColorKey, zero]; NSLog ([NSString stringWithFormat: @ "LOOL% d", [test count]]);  

The first log, when running through the debugger is running fine. However, I have tied the following code in the button:

  - (zero) search: (id) from sender {nsstring string string with format: @ "lol% d", [test Count] ]);  

When this code crashes with the bad bad access to the log line nothing the view is happening with the NSDictionary between the load and the button press, so why not Happening? And more importantly, how do I fix it?

Edit I thought maybe it was my SearchField class talking, so I changed them with simple strings, The problem still occurs.

"itemprop =" text ">

You are reaching the member variable directly - you need to go through the accelerator - that is:

  self.test = [NSDictionary dictionaryWithObje ...  

Make sure that your object retains the dictionary.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -