In previous versions (10.2.5) of the ArcGIS Runtime for iOS, I have been able to reference a web map when instantiating the AGSPopupsContainerViewController like this:
// Iniitalize popup view controller
self.popupVC = AGSPopupsContainerViewController(webMap: self.webMap, forFeature: self.newSighting, usingNavigationControllerStack: false)
self.popupVC.delegate = self
In the Quartz release the AGSWebMap class has been deprecated and the new popup vc class is AGSPopupViewController, which does not have an option to use a web map or an Item ID. When creating a map, I can still reference a web map like below and the layers within come in symbolized correctly, but the popups view controller does not seem to honor the popup definition set in the web map.
override func viewDidLoad() {
super.viewDidLoad()
// reference map and mapView
self.map = AGSMap(url: URL(string: "https://www.arcgis.com/home/webmap/viewer.html?webmap=" + webmapID)!)
self.mapView.map = self.map
// set touch delegate for identify
self.mapView.touchDelegate = self
//register as an observer for loadStatus property on map
self.map.addObserver(self, forKeyPath: "loadStatus", options: .new, context: nil)
}
// poups view controller is defined in this
//MARK: - AGSGeoViewTouchDelegate to handle identify on touch
func geoView(_ geoView: AGSGeoView, didTapAtScreenPoint screenPoint: CGPoint, mapPoint: AGSPoint) {
if let lastQuery = self.lastQuery{
lastQuery.cancel()
}
self.lastQuery = self.mapView.identifyLayer(self.breweries, screenPoint: screenPoint, tolerance: 12, returnPopupsOnly: false, maximumResults: 10) { [weak self] (identifyLayerResult: AGSIdentifyLayerResult) -> Void in
if let error = identifyLayerResult.error {
print(error)
}
else if let weakSelf = self {
// get popups from touch results
var popups = [AGSPopup]()
let geoElements = identifyLayerResult.geoElements
for geoElement in geoElements {
let popup = AGSPopup(geoElement: geoElement)
popups.append(popup)
}
if popups.count > 0 {
weakSelf.popupsVC = AGSPopupsViewController(popups: popups, containerStyle: .navigationBar)
// set custom action button to display directions in apple maps
let directionsBtn: UIBarButtonItem = UIBarButtonItem()
directionsBtn.title = "Directions"
directionsBtn.width = CGFloat(100)
directionsBtn.action = #selector(ViewController.getAppleDirections) // call our function
directionsBtn.target = weakSelf
weakSelf.popupsVC.customActionButton = directionsBtn
weakSelf.popupsVC.modalPresentationStyle = .formSheet
weakSelf.present(weakSelf.popupsVC, animated: true, completion: nil)
weakSelf.popupsVC.delegate = weakSelf
}
}
}
}
However, when I identify features the popup shows all the fields, not how the popup is configured in the web map. I have never used the Quartz release until this app, am I missing something for getting the popup definition from the web map?