Note that there are some explanatory texts on larger screens.

plurals
  1. POLoading multiple sets of annotations onto map kit map
    primarykey
    data
    text
    <p>im trying to show on a map two json files simulteniously. But there is the problem it gives me weird errors which I can't figure it out. So originaly there was</p> <pre><code> - (void)viewDidLoad { [super viewDidLoad]; NSMutableArray * annotations = [[NSMutableArray alloc] init]; self.mapView.visibleMapRect = MKMapRectMake(135888858.533591, 92250098.902419, 190858.927912, 145995.678292); NSLog(@"Loading data…"); dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ NSData * JSONData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:self.seedFileName ofType:@"json"]]; for (NSDictionary * annotationDictionary in [NSJSONSerialization JSONObjectWithData:JSONData options:kNilOptions error:NULL]) { ADClusterableAnnotation * annotation = [[ADClusterableAnnotation alloc] initWithDictionary:annotationDictionary]; [annotations addObject:annotation]; [annotation release]; } dispatch_async(dispatch_get_main_queue(), ^{ NSLog(@"Building KD-Tree…"); [self.mapView setAnnotations:annotations]; }); }); [annotations release]; } </code></pre> <p>so i saw that i have two ViewControllers which holds the the seedfile this one is</p> <pre><code>#import "CDStreetlightsMapViewController.h" @implementation CDStreetlightsMapViewController - (NSString *)pictoName { return @"CDStreetlight.png"; } - (NSString *)clusterPictoName { return @"CDStreetlightCluster.png"; } - (NSString *)seedFileName { return @"CDStreetlights"; } - (NSString *)seedFileName1 { return @"CDToilets"; } @end </code></pre> <p>the other one is</p> <pre><code>#import "CDToiletsMapViewController.h" @implementation CDToiletsMapViewController - (NSString *)seedFileName { return @"CDToilets"; } - (NSString *)pictoName { return @"CDToilet.png"; } - (NSString *)clusterPictoName { return @"CDToiletCluster.png"; } @end </code></pre> <p>The json files are named CDToilets and CDStreetlights... but i have a tab bar which holds Toilets and streetlights. But lets say i would like to display on the toilets viewController the streetlights and the toilets? thats my problem right know.. I tried this </p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; NSMutableArray * annotations = [[NSMutableArray alloc] init]; self.mapView.visibleMapRect = MKMapRectMake(135888858.533591, 92250098.902419, 190858.927912, 145995.678292); NSLog(@"Loading data…"); dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ NSData * JSONData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:self.seedFileName ofType:@"json"]]; for (NSDictionary * annotationDictionary in [NSJSONSerialization JSONObjectWithData:JSONData options:kNilOptions error:NULL]) { ADClusterableAnnotation * annotation = [[ADClusterableAnnotation alloc] initWithDictionary:annotationDictionary]; [annotations addObject:annotation]; [annotation release]; } NSData * JSONData1 = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:self.seedFileName1 ofType:@"json"]]; for (NSDictionary * annotationDictionary in [NSJSONSerialization JSONObjectWithData:JSONData1 options:kNilOptions error:NULL]) { ADClusterableAnnotation * annotation = [[ADClusterableAnnotation alloc] initWithDictionary:annotationDictionary]; [annotations addObject:annotation]; [annotation release]; } dispatch_async(dispatch_get_main_queue(), ^{ NSLog(@"Building KD-Tree…"); [self.mapView setAnnotations:annotations]; }); }); [annotations release]; } </code></pre> <p>i renamed in the <code>CDStreetlightsMapViewController</code> the <code>seedfile</code> as <code>seedfile1</code> so i can use it two times in <code>viewDidLoad</code> it didn't show errors but it didn't run well on simulator and I get an exception:</p> <pre><code>ClusterDemo[11014:c07]Loading data… ClusterDemo[11014:1303]***Assertion failure in -[CDToiletsMapViewController seedFileName1], ADClusterMapView-master-7/ClusterDemo/Classes/CDMapViewController.‌​m:86 2013-11-25 23:59:37.524 ClusterDemo[11014:1303]***Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This abstract method must be overridden!' *** First throw call stack: (0x18b2012 0x1277e7e 0x18b1e78 0xd0df35 0x3fad 0x36cb 0x2deb53f 0x2dfd014 0x2dee2e8 0x2dee450 0x99843e72 0x9982bdaa) libc++abi.dylib: terminate called throwing an exception (lldb) </code></pre> <p>you can download the full app here... <a href="https://github.com/applidium/ADClusterMapView" rel="nofollow">https://github.com/applidium/ADClusterMapView</a> </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. 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