Note that there are some explanatory texts on larger screens.

plurals
  1. POUIRefreshControl - Terminating app due to uncaught exception
    primarykey
    data
    text
    <p>I implemented UIRefreshControl on a Table View inside a UITableViewController. Today my friend (first tester) was playing with the app and he was able to make crash by pulling to refresh and while it's refreshing, pulling on it again very quickly a couple of times. I know it's not a common thing to do but I can recreate it very easily. I'm guessing there's something wrong with the way I'm implementing the refresh control since I tried to recreate it with the Gmail app and it didn't crash.</p> <p>This is the error I get: </p> <blockquote> <p>[1008:907] <strong>* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*</strong> -[__NSCFConstantString stringByAppendingString:]: nil argument' <em>*</em> First throw call stack: (0x343f32a3 0x3c08d97f 0x343f31c5 0x34c5c5e1 0x496b5 0x3624654d 0x3622b313 0x362427cf 0x361fe803 0x35fa8d8b 0x35fa8929 0x35fa985d 0x35fa9243 0x35fa9051 0x35fa8eb1 0x343c86cd 0x343c69c1 0x343c6d17 0x34339ebd 0x34339d49 0x37efb2eb 0x3624f301 0x46da5 0x3c4c4b20) libc++abi.dylib: terminate called throwing an exception (lldb) </p> </blockquote> <p>Under ViewDidLoad</p> <pre><code>// pull to refresh UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; [refreshControl addTarget:self action:@selector(updateTableView:) forControlEvents:UIControlEventValueChanged]; [self setRefreshControl:refreshControl]; </code></pre> <p>And this is the updateTableView method:</p> <pre><code>- (void)updateTableView:(id)sender { NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"MMM d, h:mm:ss a"]; NSString *lastUpdated = [NSString stringWithFormat:@"Last updated on %@", [formatter stringFromDate:[NSDate date]]]; self.refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:lastUpdated]; if(topOptions.selectedSegmentIndex == 0) { //fetch the feed _feed = [[FetchData alloc] initFromURLWithString:@"some json file" completion:^(JSONModel *model, JSONModelError *err) { [self.tableView reloadData]; [(UIRefreshControl *)sender endRefreshing]; }]; } else if (topOptions.selectedSegmentIndex == 1) { //fetch the feed _feed = [[FetchData alloc] initFromURLWithString:@"another json file" completion:^(JSONModel *model, JSONModelError *err) { [self.tableView reloadData]; [(UIRefreshControl *)sender endRefreshing]; }]; } } </code></pre> <p>I'm guessing (from the nil argument) that by doing the refresh request many times it reaches a point that it can't find a value? I'm kind of new at this so any idea is really appreciated.</p> <p>If you need any other part of the code let me know.</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