0

I am walking through the basic iOS guide to add a map to my App here: https://developers.arcgis.com/ios/10-2/swift/guide/develop-your-first-map-app.htm

When running the app, it displays the basemap I have added but it does not seem to respond to any actions so I can not pane/zoom.

Here is my exact Swift controller code:

import UIKit
import ArcGIS

class ViewController: UIViewController, AGSMapViewLayerDelegate {

@IBOutlet var mapView: AGSMapView!

override func viewDidLoad() {

    super.viewDidLoad()

    let tiledLayer = AGSLocalTiledLayer(name: "Norfolk")

    self.mapView.addMapLayer(tiledLayer, withName: "Norfolk")

    mapView.locationDisplay.startDataSource()
}

}

I have tested on both an iPad and iPhone and the behavior is the same.

I am using ArcGIS 10.2.5

Nate23VT
  • 423
  • 8
  • 27

2 Answers2

0

Where is your map url?

 let url = NSURL(string: "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer")
 let tiledLayer = AGSTiledMapServiceLayer(URL: url)
 self.mapView.addMapLayer(tiledLayer, withName: "Basemap Tiled Layer")

And have you added Privacy - Location When In Use Usage Description into info.plist of your app? You should do that if you call

mapView.locationDisplay.startDataSource()
Nik Yekimov
  • 2,657
  • 2
  • 24
  • 34
  • I should have specified this, but my version is modified slightly to show a local tpk file ("Norfolk.tpk"). I can see the TPK file within the AGSMapView, it just will not let me pan and zoom. – Nate23VT Jan 30 '17 at 17:47
  • However, I have tried the URL you have added and it does the same thing. I have also included the Privacy string in my plist file, I see the current location icon on the map. – Nate23VT Jan 30 '17 at 17:48
  • yeah, by default in ESRI there are no UI elements to zoom in/out a mapView. I don't know if there is a way to enable them. And I am using an actual device, it zooms in/out a mapView on touches. – Nik Yekimov Jan 30 '17 at 17:50
  • What I see from docs after a brief search, ESRI only provides you with programmatic ways of zoom in/out, probably they want you to add any UI elements for zoom yourself. – Nik Yekimov Jan 30 '17 at 17:54
  • These are not UI elements, just basic functionality of the SDK. I have seen other implementations of the ArcGIS SDK and I know pinch-zoom and pan are "out of the box" features after adding a layer. – Nate23VT Jan 30 '17 at 18:03
0

I am not sure what I did incorrectly the first time, but I removed the view and re added it and it worked the 2nd time.

Nate23VT
  • 423
  • 8
  • 27