I currently have a list of 32 records, each record has 74 label/value pairs. I need to cycle through 63 of these label/value pairs for the entire list. Obviously I can’t use records any more. The values in each record will change every week and the list is saved to user defaults.
What is the best way to convert from lists/records to arrays/dictionaries?
Thanks in advance,
Brad
I’m not sure what you’re asking. If you make your list of records an array (using arrayWithArray_), you will get an array of dictionaries.
I added this line to my code after the list of records (theTeams) is created:
set theTeamsArray to arrayWithArray_(theTeams)
and here is the output:
2012-08-22 20:06:59.375 NFL Spreads Generator[7570:1307] (
{
conference = NFC;
conferenceLosses = 3;
conferencePercentage = “0.75”;
…
…
…
winPercent = “0.8129999999999999”;
winStreak = 8;
wins = 13;
},
…
…
…
{
conference = AFC;
conferenceLosses = 8;
conferencePercentage = “0.333”;
…
…
…
winPercent = “0.313”;
winStreak = 1;
wins = 5;
}
)
2012-08-22 20:06:59.533 NFL Spreads Generator[7570:1307] *** -[NFL_Spreads_GeneratorAppDelegate arrayWithArray:]: unrecognized selector sent to object <NFL_Spreads_GeneratorAppDelegate @0x400c1f0e0: OSAID(14)>
2012-08-22 20:06:59.535 NFL Spreads Generator[7570:1307] *** -[NFL_Spreads_GeneratorAppDelegate openLeagueStatsFileDone:]: *** -[NFL_Spreads_GeneratorAppDelegate arrayWithArray:]: unrecognized selector sent to object <NFL_Spreads_GeneratorAppDelegate @0x400c1f0e0: OSAID(14)> (error -10000)
What am I missing? I defined both theTeams and theTeamsArray as properties:
property theTeams : {}
property theTeamsArray : missing value
I’d like to get this version of the app running and then re-write it in Obj-C as a way to learn Obj-C.
arrayWithArray_ is a class method, so you need:
set theTeamsArray to current application's NSArray's arrayWithArray_(theTeams)
Thanks Shane. I didn’t read down far enough in your book. D’Oh!