Note that there are some explanatory texts on larger screens.

plurals
  1. POCSV parse from NSMutableURLRequest misses first 150 rows
    primarykey
    data
    text
    <p>I'm reading a <code>.CSV</code> file on a server using <code>NSMutableURLRequest</code> and when I did CSV parsing of the data, I end up reading the plot points incomplete. For example if i have 300 plus rows the app reads it from 150th plus row. Any suggestion on how to approach this? Is there a function that stores the value of the plot points? Sorry I'm new to iOS. Thanks much for the help</p> <pre><code> - (id) init { // regular [super init], etc. etc. NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(_connectionTimer:) userInfo:nil repeats:YES]; // other custom initialization continues return self; } -(void)serverConnect{ NSMutableURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"URL/test.csv"] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0]; NSURLConnection *connection= [[NSURLConnection alloc] initWithRequest:request delegate:self]; } - (void) _connectionTimer:(NSTimer *)timer { [self serverConnect]; } -(void)connection :(NSURLConnection *) connection didReceiveData:(NSData *)data{ response = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *stripped1 = [response stringByReplacingOccurrencesOfString:@"\r" withString:@""]; NSMutableArray *rows = [NSMutableArray arrayWithArray:[stripped1 componentsSeparatedByString:@"\n"]]; NSMutableArray *contentArray = [NSMutableArray arrayWithCapacity:[rows count]]; NSMutableArray *contentArray1 = [NSMutableArray arrayWithCapacity:[rows count]]; NSArray *components; for (int i=0;i&lt;[rows count]; i++) { if(i == 0 || [[rows objectAtIndex:i] isEqualToString:@""]){ continue; } components = [[rows objectAtIndex:i] componentsSeparatedByString:@","]; id x = [components objectAtIndex:0] ; id y = [components objectAtIndex:1]; id z = [components objectAtIndex:2]; [contentArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:x,@"X",y,@"Y", nil]]; [contentArray1 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:x,@"X",z,@"Y", nil]]; } } - (void)viewDidLoad { [super viewDidLoad]; [_graphHostingView setContentSize:CGSizeMake(2000, 1000)]; _graphHostingView.scrollEnabled = YES; _graphHostingView.showsHorizontalScrollIndicator = YES; _graphHostingView.showsVerticalScrollIndicator = YES; [self init]; //[self serverConnect]; } </code></pre> <p>variable response is <code>NSString</code>. Will it be better if i use <code>MSMutableString</code> or <code>NSMutableArray</code> ? If not can anyone explain how <code>-(NSArray *)numbersForPlot:(CPPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange;</code> method helps? Does it help me save the plot data ? So next can I just load it when the core plot is used to plot? Is the use of timer affecting the data that is being read?</p>
    singulars
    1. This table or related slice is empty.
    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. 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