Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9194589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:27:00+00:00 2026-06-17T21:27:00+00:00

When I use this code to try and call Lat & Long coordinates from

  • 0

When I use this code to try and call Lat & Long coordinates from a MySQL database (and display them on a MapView), the app runs fine. Everything appears to work, but for some reason, xcode pauses the simulator before the map loads, and throws me a SIGABRT. Any idea why? See below:

MapViewController.h

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>


    @interface MapViewController : UIViewController  <MKMapViewDelegate> 

        @property (nonatomic, strong) IBOutlet MKMapView *mapView;
        @property (nonatomic, retain) NSMutableArray *dispensaries;
        @property (nonatomic, retain) NSMutableData *data;


    @end

MapViewController.m

#import "MapViewController.h"
#import "MapViewAnnotation.h"


    @implementation MapViewController
    @synthesize mapView;
    @synthesize dispensaries;
    @synthesize data;



    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // Custom initialization
        }
        return self;
    }

    - (void)didReceiveMemoryWarning
    {
        // Releases the view if it doesn't have a superview.
        [super didReceiveMemoryWarning];

        // Release any cached data, images, etc that aren't in use.
    }

    #pragma mark - View lifecycle

    - (void)viewDidLoad {

    [super viewDidUnload];



            NSLog(@"Getting Device Locations");

            NSString *hostStr = @"http://stylerepublicmagazine.com/dispensaries.php";
            NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:hostStr]];
            NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];
            NSLog(@"server output: %@", serverOutput);
            NSMutableArray *array = (NSMutableArray *)dispensaries;
            dispensaries = [NSJSONSerialization JSONObjectWithData:data options:nil error:nil];

            for (NSDictionary *dictionary in array) {



                CLLocationCoordinate2D coord = {[[dictionary objectForKey:@"lat"] doubleValue], [[dictionary objectForKey:@"lng"] doubleValue]};

                MapViewAnnotation *ann = [[MapViewAnnotation alloc] init];
                ann.title = [dictionary objectForKey:@"Name"];
                ann.coordinate = coord;
                [mapView addAnnotation:ann];



        [mapView setMapType:MKMapTypeStandard];
        [mapView setZoomEnabled:YES];
        [mapView setScrollEnabled:YES];



        self.mapView.delegate = self;


    }

    }

    - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation

    {
        MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 800, 800);
        [self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];


    MKPointAnnotation *point = [[MKPointAnnotation alloc] init];
    point.coordinate = userLocation.coordinate;
    point.title = @"You Are Here";
    point.subtitle = @"Your current location";

    [self.mapView addAnnotation:point];



    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:27:01+00:00Added an answer on June 17, 2026 at 9:27 pm

    Ok, so now you have the JSON. You are going to have to decode that using NSXMLParser. Or, if you want to turn that into objects, you could use my open source library on GitHub, which allows you to simply implement NSCoding protocol and instantiate objects (or encode them) as JSON. That’s here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try to execute an external program from java I use this code
I use the following code to retrieve the data from MySql database. GContnStr is
When I try to use this code: FacebookViewController *manager = [FacebookViewController sharedManager]; to call
When I try to remove Components from a Container, I use this code. private
I try to use this jQuery code to call for Changes.php with $_POST[fname] =
I try to update my profile image and use this code: $connection->post('account/update_profile_image', array('image' =>
I use this code to select password field from the sql server 2012 db,
I use this code to update data in database table. Can reuse same code
I use this code to process a date string coming in from a json
I use this code which is taken from MVC futures and attach the Attribute

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.