0

First off my background in Xcode and Swift is nonexistent. This is the first code I've attempted to write and I'm getting nowhere. Please help!

All I'm trying to do at the moment is pull up map view in the simulator but all I get is a grid not an actual map.

Note: I've linked in the MapKit.framework and made zero changes to AppDelegate.swift.

The following is code in ViewController.swift:

import UIKit
import MapKit

class ViewController: UIViewController, MKMapViewDelegate {


    @IBOutlet weak var mapView: MKMapView!


    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    @IBAction func zoomIn(sender: AnyObject) {
    }

    @IBAction func changeMapType(sender: AnyObject) {
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

PLEASE HELP!!!! Stack overflow won't allow me to post images so hopefully this is enough!

Ian MacDonald
  • 13,472
  • 2
  • 30
  • 51
  • 1
    Welcome to Stack Overflow. Can you describe the issue that you're seeing in any more detail? Does it the grid scroll properly? Is it possible that this grid you're seeing is a map that was unable to load tile data? – Ian MacDonald Feb 26 '15 at 21:07
  • Yes, the grid does scroll properly. I can also double click the map and it seems to have three zoom modes. It just does not seem to load the map. I am getting "could not determine current country code: error domain....connection lost" as the output in xcode. Is there a simple network enable to run off my computer wifi? – Matthew_F Feb 26 '15 at 21:42
  • If you choose `Debug -> Location -> Apple` for your iOS Simulator, it should fake a location for you. – Ian MacDonald Feb 26 '15 at 21:46
  • I've tried that along with turning on simulate location (London,England) but no luck. – Matthew_F Feb 26 '15 at 21:53
  • This might be a silly question because you're posting to a site on the internet, but does your simulator have a network connection? It will need to be able to access the internet to download the map data. – Ian MacDonald Feb 26 '15 at 21:54
  • The simulator shows "Carrier with full bar wifi icon". So I assume it has a network connection through my computer wifi? Do I need to enable internet anywhere in xcode? – Matthew_F Feb 26 '15 at 21:58
  • This is the output Xcode gives me.Could not determine current country code: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo=0x7ff5c05c2110 {NSUnderlyingError=0x7ff5c04506e0 "The network connection was lost.", NSErrorFailingURLStringKey=http://gsp1.apple.com/pep/gcc, NSErrorFailingURLKey=http://gsp1.apple.com/pep/gcc, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=57, NSLocalizedDescription=The network connection was lost.} – Matthew_F Feb 26 '15 at 22:45

1 Answers1

0

The iOS simulator freaks out when you move around, or it's open for too long. Simply quitting the simulator and running your project again should do the trick.

brimstone
  • 3,370
  • 3
  • 28
  • 49
  • Thanks for the input but that still didn't work. I keep getting this output – Matthew_F Feb 27 '15 at 00:24
  • 2015-02-26 18:23:33.256 Where_Am_I_Swift_Universal[2997:85839] Could not determine current country code: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo=0x7f95dfbf0f00 {NSUnderlyingError=0x7f95db6a9d80 "The network connection was lost.", NSErrorFailingURLStringKey=http://gsp1.apple.com/pep/gcc, NSErrorFailingURLKey=http://gsp1.apple.com/pep/gcc, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=57, NSLocalizedDescription=The network connection was lost.} – Matthew_F Feb 27 '15 at 00:24
  • Try these answers: http://stackoverflow.com/questions/25372318/error-domain-nsurlerrordomain-code-1005-the-network-connection-was-lost – brimstone Feb 27 '15 at 01:14