NSMutableDictionary setting value causes crash -


nsmutabledictionary             *firstcurr;  nslog(@"currency list count=%d",[self.currencylist count]);  (int j=0; j<[self.currencylist count]; j++) { nslog(@"j=%d",j); firstcurr                   =   [self.currencylist objectatindex:j]; [firstcurr                      setvalue:[nsnumber numberwithfloat:     [[currencyitems objectatindex:j]floatvalue]] forkey:kselectedcurrencyinr]; } 

i have array of nsmutabledictionary objects called currency list, trying set 1 field of nsmutabledictionary. accessing firstcurr in marked line causes crash!

nsmutablearray                          *arr; arr                                 =   [[[nsmutablearray alloc] init] autorelease];  [[nsuserdefaults standarduserdefaults]  setobject:arr forkey:kselectedcurrencies]; 

this how add in array

nsdictionary *dict = [[[nsmutabledictionary alloc] init] autorelease];  [dict setvalue:countrycode[pos] forkey:kselectedcurrencycode]; [dict setvalue:countryname[pos] forkey:kselectedcurrencycountry]; [dict setvalue:[nsnumber numberwithfloat:2.0] forkey:kselectedcurrencyinr]; [dict setvalue:currencyname[pos] forkey:kselectedcurrencyname]; [temp addobject:dict]; [[nsuserdefaults standarduserdefaults] setobject:temp forkey:kselectedcurrencies]; [[nsuserdefaults standarduserdefaults] synchronize]; 


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -