Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had a similar problem at one point. What I ended up doing was writing a simple application that took a CSV file and converted it into a Plist. Then I used the Plist as needed in the app. This code uses <a href="http://michael.stapelberg.de/cCSVParse" rel="nofollow noreferrer">cCSVParse</a>. It will use the headers in the first row as the key names to create an array of dictionaries for each successive row. The output is a tidy plist file with all of your data. Use [NSArray arrayWithContentsOfFile:] to pop the data into memory in your app.</p> <pre><code> CSVParser *parser = [CSVParser new]; [parser openFileWithPath:pathAsString]; NSMutableArray *csvContent = [parser parseFile]; [parser closeFile]; if (pathAsString != nil) { NSArray *keyArray = [csvContent objectAtIndex:0]; NSMutableArray *plistOutputArray = [NSMutableArray array]; NSInteger i = 0; for (NSArray *array in csvContent) { NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; NSInteger keyNumber = 0; for (NSString *string in array) { [dictionary setObject:string forKey:[keyArray objectAtIndex:keyNumber]]; keyNumber++; } if (i &gt; 0) { [plistOutputArray addObject:dictionary]; } i++; } NSMutableString *mutableString = [NSMutableString stringWithString:pathAsString]; [mutableString replaceOccurrencesOfString:@".csv" withString:@".plist" options:nil range:NSMakeRange([mutableString length]-4, 4)]; NSURL *url = [NSURL fileURLWithPath:mutableString]; [plistOutputArray writeToURL:url atomically:YES]; </code></pre> <p>I also built a pretty simple UI for this. Maybe I'll clean up the whole project and post it on Google Code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload