|
POST
|
Great stuff. Good to hear. Would you mind marking some answers as Helpful etc.? Nothing like that Esri Community Karma Thanks! Nick.
... View more
01-29-2018
07:51 AM
|
0
|
4
|
5229
|
|
POST
|
I'm betting that code is within a func. That func is being exited before the async call returns, and so "table" is being deallocated before the service responds and the block isn't being called. Try making the "table" variable a class variable instead. So something like this. class ViewController: NSViewController {
...
// Declare "table" here as a class-level variable
// table will not be deallocated just because queryTable() finished.
var table:AGSServiceFeatureTable!
func queryTable() {
// Here we set the class level variable rather than declaring
// a local variable that is deallocated when the function exits.
table = AGSServiceFeatureTable(item: portalItem, layerID: 0)
let params = AGSQueryParameters()
params.whereClause = "1=1"
// Fire off the query asynchronously... But...
table.queryFeatures(with: params, completion: { (results, error) in
guard error == nil else {
print("Error querying... \(error!.localizedDescription)")
return
}
print("Got a result")
})
// ...the code will exit this function before the query returns.
}
...
} Note that this isn't going to happen if you're reading from, say, a layer on a map in a mapview with something like (pseudocode alert) mapview.map.operationalLayers[0].featureTable because the map and layer will still be "alive" so you'll be querying against a table that isn't going to be deallocated (it's referenced by the layer which is referenced by the map which is referenced by the mapview which is referenced by the app's UI). In this case what you're seeing is because you're declaring a standalone table item that Swift will deallocate just like any other variable declared in that block.
... View more
01-28-2018
07:14 PM
|
1
|
6
|
5229
|
|
POST
|
Aha. Ok, so that property refers to what's cached locally in the feature table. You would need to set the table's featureRequestMode to Manual for that and call populateFromServiceWithParameters. But that's more advanced than you need… Instead, just call one of the query functions. If you need to know the total record count in the service, use a queryParameter with whereClause of 1=1 and call queryFeatureCountWithParameters to get the result. That's an async operation by necessity. Here are some links that could help: Layers and tables—ArcGIS Runtime SDK for iOS | ArcGIS for Developers Loadable pattern for asynchronous resources—ArcGIS Runtime SDK for iOS | ArcGIS for Developers Feature layer query—ArcGIS Runtime SDK for iOS | ArcGIS for Developers iOS DevLabs: Browse ArcGIS DevLabs | ArcGIS for Developers Service feature table (no cache)—ArcGIS Runtime SDK for iOS | ArcGIS for Developers Feature layer (feature service)—ArcGIS Runtime SDK for iOS | ArcGIS for Developers Service feature table (manual cache)—ArcGIS Runtime SDK for iOS | ArcGIS for Developers Features and graphics—ArcGIS Runtime SDK for iOS | ArcGIS for Developers If eventually you need to work with all data locally on the device, those workflows are also supported by the Runtime, but to get started the workflows involve connecting to your hosted service and working against that.
... View more
01-28-2018
09:31 AM
|
1
|
8
|
5229
|
|
POST
|
Hi Trevor. That's Xcode being a pain. I'm sure if you just type the constructor like this it'll compile: let table = AGSServiceFeatureTable(item: portalItem, layerID: 0)
let layer = AGSFeatureLayer(featureTable: table)
One thought - can you scroll up in that autocomplete list? Perhaps Xcode is scrolling you to the second suggestion for some reason (I think I've seen that before). Alternatively, if you have other errors in the code, Xcode can get confused with what it offers for autocomplete. Xcode gets better at this with each release, in case you're not on the latest. Nick.
... View more
01-27-2018
04:39 PM
|
1
|
10
|
5229
|
|
POST
|
Hi. The short answer is that the "data" you're getting with fetchData() is the metadata describing the Portal Item (mostly the stuff you'd see if you browse to the web page for that portal item). What you are looking to do is to create an AGSServiceFeatureTable. You can do that using serviceFeatureTableWithItem:layerID() (most likely you'll use layer ID 0, but a feature service can have many layers, depending on how it was published). Then you can call queryFeaturesWithParameters:completion() to get the features and iterate over those. You'll be working with AGSQueryParameters an AGSFeatureQueryResult. If you find that not all your fields are coming back when you query, consider using queryFeaturesWithParameters:queryFeatureFields:completion:() instead, specifying that you want to Load All fields. When working with the AGSQueryParameters, a couple of things to note: If you just need all records, you should set the where clause to "1=1". It's a trick that always evaluates to true and so returns everything. But if you have a where clause in mind to filter down or are passing a geometry in to constrain the results geographically, no need to use that. If you have a lot of features in your feature service, you should use maxFeatures and resultOffset to get pages of data at a time. One last thing. If you just want to show the feature layer on a map, you can just create an ASGFeatureLayer from the AGSServiceFeatureTable and add that to a map. The Runtime will take care of querying as necessary to retrieve and display the data. Hope this helps! Nick. P.S. By the way, to post code, you can expand the editing toolbar, then select More->Syntax Highlighter.
... View more
01-25-2018
04:51 PM
|
1
|
12
|
5229
|
|
POST
|
Indeed. I've pointed the .NET team at your question. I did overhear something about whitelisting using the project manifest/settings but since it's way out of my wheelhouse I'll wait for them to pipe up. That might give you something to look into in the meantime though.
... View more
01-16-2018
09:21 AM
|
0
|
1
|
5087
|
|
POST
|
FYI: In Runtime 100, the iOS SDK moved the trustedHosts property to the AGSAuthenticationManager. But we'll get this moved over for the .NET/Xamarin folks to chip in.
... View more
01-16-2018
08:51 AM
|
0
|
3
|
5087
|
|
POST
|
Take a look at the search parameters here. You should be able to use either the access property or the orgid term to build an AGSPortalQueryParameters using queryParametersWithQuery() to pass to the portal.findItems() call. If you use orgid, you can get it from portal.portalInfo.organizationID. Also, since this could return a lot of items, consider paging through the results. Let me know how that goes!
... View more
01-16-2018
06:58 AM
|
1
|
0
|
741
|
|
BLOG
|
In mid-december, just in time for the holidays, we released ArcGIS Runtime 100.2.0 across all supported platforms (which of course includes iOS). It is available for you to download here. This is an exciting release for the entire team because it brings us closer to functional parity with the 10.2.x versions of Runtime and is what we originally envisioned Runtime 100 to be. Here are some highlights: Read and edit Shapefiles Read and edit vector data from GeoPackages Read rasters from GeoPackages Support for multi-layered symbology Time support Display and identify WMS layers Display and identify ENC layers (Electronic Navigational Charts) Create and update mosaic raster datasets On-device GPU based analysis - viewshed and line of sight on the GPU Statistical queries Improved support for geotransformations and custom geotransformations Offline mapping enhancements including Preplanned workflows Support for transactional editing Take a look at our main blog post for more details. Also, at this release we no longer support Xcode 8 or iOS 9 (see the Release Notes for more details). We're already hard at work on 100.3.0 but in the meantime keep an eye out for 100.2.1 which will add a couple of bits of functionality that we couldn't quite get done in time for 100.2.0 (like encrypted ENC layers and support for some older WMS versions).
... View more
01-16-2018
06:46 AM
|
0
|
0
|
741
|
|
POST
|
Thanks for that. This is an issue that we've fixed in version 100. However, that doesn't really help you with version 10.2.5. Are you considering updating to the current Runtime SDK (version 100.x)?
... View more
12-14-2017
01:38 PM
|
0
|
0
|
2186
|
|
POST
|
Looks like the crash happened in Thread 10. Can you provide the stack for that thread please?
... View more
12-13-2017
10:01 AM
|
0
|
0
|
2186
|
|
POST
|
You might try moving your ~/.cocoapods folder out of the way in case it's confused/corrupted by the Cocoapods version update, and doing a fresh "pod install".
... View more
12-04-2017
01:51 PM
|
0
|
0
|
2183
|
|
POST
|
You should use the "rotateEnabled" property of the AGSMapView's "interactionOptions". Seems the Guide documentation is out of date. We'll get it updated. Hope that helps. Nick.
... View more
11-30-2017
04:41 PM
|
0
|
1
|
1557
|
|
POST
|
Have you tried "pod repo update --verbose" to update your local cocoapods repo cache? Failing that, you could try to manually delete the cache folder in ~/Library/Caches/CocoaPods
... View more
11-30-2017
10:02 AM
|
0
|
3
|
2183
|
|
POST
|
Hi, Assuming you have a reference to the AGSMapView named mapView, then if you're using Runtime 100.x, you can use KVO on the map's mapScale property, like this: override func viewDidLoad() {
super.viewDidLoad()
mapView.addObserver(self, forKeyPath: "mapScale", options: [.new, .old], context: nil)
}
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if let mapViewThatChanged = object as? AGSMapView, keyPath == "mapScale" {
print("Map scale changed to \(mapViewThatChanged.mapScale)")
}
} or if you're using Swift 4, it might look like this: private var scaleKvoToken:NSKeyValueObservation?
override func viewDidLoad() {
super.viewDidLoad()
scaleKvoToken = mapView.observe(\.mapScale) { mapViewThatChanged, _ in
print("Map scale changed to \(mapViewThatChanged.mapScale)")
}
}
... View more
11-07-2017
10:34 AM
|
2
|
0
|
991
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | Thursday | |
| 2 | 2 weeks ago | |
| 4 | 3 weeks ago | |
| 1 | 01-29-2026 09:39 AM | |
| 1 | 12-17-2025 10:12 AM |