Note that there are some explanatory texts on larger screens.

plurals
  1. POCollection <CALayerArray: 0x1cdb9b90> was mutated while being enumerated
    primarykey
    data
    text
    <p>i realise this has been asked many times, but i just don't know where the fault lies in my code, sorry for being dumb. </p> <p>I do know the fault is from this method:</p> <pre><code>-(void)getDataFromDatabase { UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; indicator.frame = CGRectMake(0.0, 0.0, 40.0, 40.0); indicator.center = self.view.center; [indicator bringSubviewToFront:self.view]; [UIApplication sharedApplication].networkActivityIndicatorVisible = TRUE; [indicator startAnimating]; CGRect screenRect = [[UIScreen mainScreen] bounds]; UIView *overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, screenRect.size.width, screenRect.size.height)]; overlay.backgroundColor = [UIColor whiteColor]; [self.view addSubview:overlay]; [self.view addSubview:indicator]; NSString *listingurl; listingurl = [NSString stringWithFormat:@"http://www.herefordshire-tourism-guide.co.uk/app/query.php?getlisting=1&amp;listingname=%@", rowSelectedName]; listingurl = [listingurl stringByReplacingOccurrencesOfString:@" " withString:@"%20"]; NSURL *url = [NSURL URLWithString:listingurl]; NSError *error = nil; NSStringEncoding encoding; NSString *jsonreturn = [[NSString alloc] initWithContentsOfURL:url usedEncoding:&amp;encoding error:&amp;error]; NSData *jsonData = [jsonreturn dataUsingEncoding:NSUTF32BigEndianStringEncoding]; // In "real" code you should surround this with try and catch NSDictionary * dict = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&amp;error]; if (dict) { rows = dict[@"listings"]; } dict = rows[0]; self.photos.font = [UIFont fontWithName:@"ProximaNova-Regular" size:18.0]; self.likes.font = [UIFont fontWithName:@"ProximaNova-Regular" size:18.0]; self.businessName.font = [UIFont fontWithName:@"ProximaNova-Extrabld" size:20.0]; self.address.font = [UIFont fontWithName:@"ProximaNova-Regular" size:16.0]; self.navigationItem.title = dict[@"business"]; NSString *favdb = [NSString stringWithFormat:@"%@", dict[@"favs"]]; if ([favdb isEqualToString:@""]) { NSString *fav = [NSString stringWithFormat:@"0 Likes"]; self.favourites.text = fav; } else { NSString *fav = [NSString stringWithFormat:@"%@ Likes", dict[@"favs"]]; self.favourites.text = fav; } if ([favdb isEqualToString:@"1"]) { NSString *fav = [NSString stringWithFormat:@"1 Like"]; self.favourites.text = fav; } self.businessName.text = dict[@"business"]; self.address.text = dict[@"location"]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL), ^(void) { UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; indicator.frame = CGRectMake(140, 85, 40.0, 40.0); [indicator bringSubviewToFront:self.view]; [indicator startAnimating]; [self.view addSubview:indicator]; UIImage *img = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:dict[@"image1"]]]]; self.image.image = img; [UIApplication sharedApplication].networkActivityIndicatorVisible = FALSE; [indicator stopAnimating]; }); listingLoc = [[CLLocation alloc] initWithLatitude:[dict[@"lat"] doubleValue] longitude:[dict[@"lon"] doubleValue]]; AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; float kilometers = [appDelegate.currentLoc distanceFromLocation:listingLoc] / 1000; int milesint = kilometers * 0.621371192; NSString *milesOut = [NSString stringWithFormat:@"%i miles", milesint]; self.distance.text = milesOut; networkImages = [[NSMutableArray alloc] init]; if (dict[@"image1"] != @"") { [networkImages addObject:dict[@"image1"]]; } [indicator stopAnimating]; [overlay removeFromSuperview]; } </code></pre> <p>and im calling that method in the viewWillAppear method...</p> <p><code>[self performSelectorInBackground:@selector(getDataFromDatabase) withObject:nil];</code></p> <p>Any tips, my code may be a bit shoddy, any help is much appreciated! </p> <p>Thanks.</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.
 

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