<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK? in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611518#M5382</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The short answer is that the "data" you're getting with fetchData() is&amp;nbsp;the metadata describing&amp;nbsp;the Portal Item (mostly the stuff you'd see if you browse to the web page for that portal item).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you are looking to do is to create an &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_service_feature_table.html"&gt;AGSServiceFeatureTable&lt;/A&gt;. You can do that using &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_service_feature_table.html#ad07e35f010506f5305217560433eff1e"&gt;serviceFeatureTableWithItem:layerID()&lt;/A&gt;&amp;nbsp;(most likely you'll use layer ID 0, but a feature service &lt;EM&gt;can&lt;/EM&gt; have many layers, depending on how it was published). Then you can call &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_service_feature_table.html#a43d152517c6ee3fa582d2f741367b7bb"&gt;queryFeaturesWithParameters:completion()&lt;/A&gt; to get the features and iterate over those. You'll be working&amp;nbsp;with &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_query_parameters.html"&gt;AGSQueryParameters&lt;/A&gt; an &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_feature_query_result.html"&gt;AGSFeatureQueryResult&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you find that not all your fields are coming back when you query, consider using &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_service_feature_table.html#a43d152517c6ee3fa582d2f741367b7bb"&gt;queryFeaturesWithParameters:queryFeatureFields:completion:()&lt;/A&gt; instead, specifying that you want to Load All fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When working with the AGSQueryParameters, a couple of things to note:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If you just need all records, you should&amp;nbsp;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.&lt;/LI&gt;&lt;LI&gt;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.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One last thing. If you just want to&amp;nbsp;show the feature layer on a map, you can just create an &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_feature_layer.html"&gt;ASGFeatureLayer&lt;/A&gt; from the AGSServiceFeatureTable and add that to a map. The Runtime will take care of querying as necessary to retrieve and display the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. By the way, to post code, you can expand the editing toolbar, then select More-&amp;gt;Syntax Highlighter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Jan 2018 00:51:47 GMT</pubDate>
    <dc:creator>Nicholas-Furness</dc:creator>
    <dc:date>2018-01-26T00:51:47Z</dc:date>
    <item>
      <title>How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611517#M5381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm building an AR app using ARKit and the ArcGIS iOS SDK. I'm trying to access the data of a Feature Layer which I'm hosting on ArcGIS Online. The Feature Layer consists of images which have been submitted by participants through a Crowdsource Story Map. Specially, I'm trying to get the location and&amp;nbsp;URL of each image in the Feature Layer, using the ArcGIS iOS SDK, so that I can then place/display them in the AR app based on that information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been working on this problem for a few days now and have been unable to come up with a solution. I'll share what I have so far, below. Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Connect to the ArcGIS Online portal&lt;/EM&gt;&lt;BR /&gt;&lt;SPAN&gt;let portal = AGSPortal(url: URL(string: "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2ForganizationName.maps.arcgis.com" rel="nofollow" target="_blank"&gt;https://organizationName.maps.arcgis.com&lt;/A&gt;&lt;SPAN&gt;")!, loginRequired: false)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Provide credentials&lt;/EM&gt;&lt;BR /&gt;portal.credential = AGSCredential(user: "username", password: "password")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Get the portal item&lt;/EM&gt;&lt;BR /&gt;let portalItem = AGSPortalItem(portal: portal, itemID: "&lt;SPAN&gt;xxxx836axxxx4781xxxxe4d58bcxxxx&lt;/SPAN&gt;")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Next I load the portal item&lt;/EM&gt;&lt;BR /&gt;portalItem.load { [weak self] (error) -&amp;gt; Void in&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; if let error = error {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("Could not load portal item due to error : \(error)")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; // Printing the portal item to the console produces the result I'm looking for. I'm getting the correct portal item.&lt;/EM&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; print("portal item is loaded \(portalItem)")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp;// The above print statements outputs the following:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;// portal item is loaded xxxx836axxxx4781xxxxe4d58bcxxxx, Feature Service, featureLayerName, organizationName, &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2ForganizationName.maps.arcgis.com%2Fsharing%2Frest%2Fcontent%2Fitems%2Fxxxx836axxxx4781xxxxe4d58bcxxxx%2Fdata" rel="nofollow" target="_blank"&gt;https://organizationName.maps.arcgis.com/sharing/rest/content/items/xxxx836axxxx4781xxxxe4d58bcxxxx/data&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Then I try to fetch the data of the portal item. This is where I get stuck. I would have thought this grabs the data of the feature layer, which would then let me get the data for each specific feature but it doesn't fetch any data (print statement outputs "0 bytes")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;portalItem.fetchData { [weak self](data, error) -&amp;gt; Void in&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if let error = error {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("Could not fetch data due to error: \(error.localizedDescription)")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; // Print statement is reached but output is "0 bytes"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if let data = data {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(data)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I apologize if there is a better way to post code on this forum. Again, any help would be awesome!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trevor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Dec 2017 20:24:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611517#M5381</guid>
      <dc:creator>TrevorPostma</dc:creator>
      <dc:date>2017-12-31T20:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611518#M5382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The short answer is that the "data" you're getting with fetchData() is&amp;nbsp;the metadata describing&amp;nbsp;the Portal Item (mostly the stuff you'd see if you browse to the web page for that portal item).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you are looking to do is to create an &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_service_feature_table.html"&gt;AGSServiceFeatureTable&lt;/A&gt;. You can do that using &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_service_feature_table.html#ad07e35f010506f5305217560433eff1e"&gt;serviceFeatureTableWithItem:layerID()&lt;/A&gt;&amp;nbsp;(most likely you'll use layer ID 0, but a feature service &lt;EM&gt;can&lt;/EM&gt; have many layers, depending on how it was published). Then you can call &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_service_feature_table.html#a43d152517c6ee3fa582d2f741367b7bb"&gt;queryFeaturesWithParameters:completion()&lt;/A&gt; to get the features and iterate over those. You'll be working&amp;nbsp;with &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_query_parameters.html"&gt;AGSQueryParameters&lt;/A&gt; an &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_feature_query_result.html"&gt;AGSFeatureQueryResult&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you find that not all your fields are coming back when you query, consider using &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_service_feature_table.html#a43d152517c6ee3fa582d2f741367b7bb"&gt;queryFeaturesWithParameters:queryFeatureFields:completion:()&lt;/A&gt; instead, specifying that you want to Load All fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When working with the AGSQueryParameters, a couple of things to note:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If you just need all records, you should&amp;nbsp;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.&lt;/LI&gt;&lt;LI&gt;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.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One last thing. If you just want to&amp;nbsp;show the feature layer on a map, you can just create an &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_feature_layer.html"&gt;ASGFeatureLayer&lt;/A&gt; from the AGSServiceFeatureTable and add that to a map. The Runtime will take care of querying as necessary to retrieve and display the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. By the way, to post code, you can expand the editing toolbar, then select More-&amp;gt;Syntax Highlighter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jan 2018 00:51:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611518#M5382</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2018-01-26T00:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611519#M5383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nicholas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for getting back to me. That's very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having trouble with one part. I'm trying to create the AGSServiceFeatureTable, but it's only giving me the options for&amp;nbsp;serviceFeatureTableWithTable and serviceFeatureTableWithUrl. Do you know why I'm not getting the serviceFeatureTableWithItem option?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="/legacyfs/online/395093_Screen Shot 2018-01-27 at 7.29.30 PM.png" style="width: 620px; height: 183px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's all I get. Maybe I'm misunderstanding something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jan 2018 23:33:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611519#M5383</guid>
      <dc:creator>TrevorPostma</dc:creator>
      <dc:date>2018-01-27T23:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611520#M5384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Trevor. That's Xcode being a pain. I'm sure if you just type the constructor like this it'll compile:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;let&lt;/SPAN&gt; table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;AGSServiceFeatureTable&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; portalItem&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; layerID&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍
&lt;SPAN class="keyword token"&gt;let&lt;/SPAN&gt; layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;AGSFeatureLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;featureTable&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; table&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One thought - can you scroll &lt;EM&gt;up&lt;/EM&gt;&amp;nbsp;in that autocomplete list? Perhaps Xcode is scrolling you to the second suggestion for some reason (I think I've seen that before).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively,&amp;nbsp;if you have other errors in the code, Xcode can get confused with what it offers for autocomplete. Xcode&amp;nbsp;gets better at this with each release, in case you're not on the latest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nick.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:09:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611520#M5384</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2021-12-12T02:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611521#M5385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nicholas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I updated the SDK&amp;nbsp;in my project from 100.1.1 to 100.2 and that resolved the issue. I'm able to use the&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;serviceFeatureTableWithItem option.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;It doesn't seem to be loading anything though, unfortunately. When I print out the number of features for the table it always returns 0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Do you know any reasons why I might be blocked from getting that data? Am I missing any steps? Do I need to load the table the same way I load the portalItem previously? I know the feature service requires a token to access the REST API endpoint, would that have anything to do with it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Sorry for all the questions.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jan 2018 15:22:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611521#M5385</guid>
      <dc:creator>TrevorPostma</dc:creator>
      <dc:date>2018-01-28T15:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611522#M5386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aha. Ok, so&amp;nbsp;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…&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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&amp;nbsp;operation by necessity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are some links that could help:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/ios/latest/swift/guide/layers.htm#ESRI_SECTION1_272346C9CB0049938539D5F8970624F2" title="https://developers.arcgis.com/ios/latest/swift/guide/layers.htm#ESRI_SECTION1_272346C9CB0049938539D5F8970624F2"&gt;Layers and tables—ArcGIS Runtime SDK for iOS | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/ios/latest/swift/guide/loadable-pattern.htm" title="https://developers.arcgis.com/ios/latest/swift/guide/loadable-pattern.htm"&gt;Loadable pattern for asynchronous resources—ArcGIS Runtime SDK for iOS | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://developers.arcgis.com/ios/latest/swift/sample-code/feature-layer-query.htm" title="https://developers.arcgis.com/ios/latest/swift/sample-code/feature-layer-query.htm"&gt;Feature layer query—ArcGIS Runtime SDK for iOS | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;iOS DevLabs:&amp;nbsp;&lt;A href="https://developers.arcgis.com/labs/browse/?topic=any&amp;amp;product=iOS" title="https://developers.arcgis.com/labs/browse/?topic=any&amp;amp;product=iOS"&gt;Browse ArcGIS DevLabs | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/ios/latest/swift/sample-code/service-feature-table-no-cache-.htm" title="https://developers.arcgis.com/ios/latest/swift/sample-code/service-feature-table-no-cache-.htm"&gt;Service feature table (no cache)—ArcGIS Runtime SDK for iOS | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/ios/latest/swift/sample-code/feature-layer-feature-service-.htm" title="https://developers.arcgis.com/ios/latest/swift/sample-code/feature-layer-feature-service-.htm"&gt;Feature layer (feature service)—ArcGIS Runtime SDK for iOS | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/ios/latest/swift/sample-code/service-feature-table-manual-cache-.htm" title="https://developers.arcgis.com/ios/latest/swift/sample-code/service-feature-table-manual-cache-.htm"&gt;Service feature table (manual cache)—ArcGIS Runtime SDK for iOS | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/ios/latest/swift/guide/features-and-graphics.htm#ESRI_SECTION1_D5F1ACC532154D27810A82460E1512CB" title="https://developers.arcgis.com/ios/latest/swift/guide/features-and-graphics.htm#ESRI_SECTION1_D5F1ACC532154D27810A82460E1512CB"&gt;Features and graphics—ArcGIS Runtime SDK for iOS | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If eventually you need to work with&amp;nbsp;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.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jan 2018 17:31:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611522#M5386</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2018-01-28T17:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611523#M5387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, that makes sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Okay, I looked through all those links you provided and it seems like I have it set up properly now, but I can't get any action inside the query itself. Here's what I have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="/legacyfs/online/395129_Screen Shot 2018-01-28 at 9.32.57 PM.png" style="width: 620px; height: 145px;" /&gt;&lt;/P&gt;&lt;P&gt;Does that look correct to you? I don't get anything in the console to indicate that I made it inside the queryFeatures completion block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your patience and help, Nicholas!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2018 01:36:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611523#M5387</guid>
      <dc:creator>TrevorPostma</dc:creator>
      <dc:date>2018-01-29T01:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611524#M5388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try making the "table" variable a class variable instead. So something like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;class&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;ViewController&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; NSViewController &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;// Declare "table" here as a class-level variable&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;// table will not be deallocated just because queryTable() finished.&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; table&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;AGSServiceFeatureTable&lt;SPAN class="operator token"&gt;!&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; func &lt;SPAN class="token function"&gt;queryTable&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;// Here we set the class level variable rather than declaring&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;// a local variable that is deallocated when the function exits.&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;AGSServiceFeatureTable&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; portalItem&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; layerID&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;let&lt;/SPAN&gt; params &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;AGSQueryParameters&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;whereClause &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"1=1"&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;// Fire off the query asynchronously... But...&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;queryFeatures&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; params&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; completion&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;results&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; error&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; guard error &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; nil &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Error querying... \(error!.localizedDescription)"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Got a result"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;// ...the code will exit this function before the query returns.&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;

&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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"&amp;nbsp;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&amp;nbsp;is because you're declaring a standalone table item that Swift will deallocate just like any other variable declared in that block.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:09:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611524#M5388</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2021-12-12T02:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611525#M5389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That did it. I'm getting the results I'm after now and should be good from here. You were a massive help, Nicholas. Thank you so much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2018 15:05:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611525#M5389</guid>
      <dc:creator>TrevorPostma</dc:creator>
      <dc:date>2018-01-29T15:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611526#M5390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great stuff. Good to hear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you mind marking some answers as Helpful etc.? Nothing like that Esri Community Karma &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nick.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2018 15:51:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611526#M5390</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2018-01-29T15:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611527#M5391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Done!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2018 18:49:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611527#M5391</guid>
      <dc:creator>TrevorPostma</dc:creator>
      <dc:date>2018-01-29T18:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611528#M5392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Nick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a follow-up question for you. Sorry if I should be opening a new question for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm able to access all the data I need, except I'm looking for a way to query a specific portal item to determine how many layers it has.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, I'm doing this:&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-cpp line-numbers"&gt;&lt;CODE&gt;let table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;AGSServiceFeatureTable&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt; contoursItem&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; layerID&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt; layerID&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Most of the portal items I'm working with have a single layer so using 0 as the layerID works in those cases. However, I have one particular portal item where I need to iterate over a number of layers and the number of&amp;nbsp;layers could change in the future. I'm getting the portal item as below. Do you know how I can get all the layerIDs for that portal item?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-cpp line-numbers"&gt;&lt;CODE&gt;portalItem &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;AGSPortalItem&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;portal&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt; portal&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; itemID&lt;SPAN class="operator token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"xxxxxItemIdxxxxx"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping I would be able to load that portal item and there would be a layersCount option but there doesn't seem to be anything like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trevor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jan 2018 15:15:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611528#M5392</guid>
      <dc:creator>TrevorPostma</dc:creator>
      <dc:date>2018-01-31T15:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611529#M5393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No problem Trevor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The AGSPortalItem is very generic (it could be a map, or a CSV file, or even an Excel&amp;nbsp;spreadsheet) so it doesn't expose type-specific info (think of it as a Content Management System item where ArcGIS Online or your own portal is the CMS but with geo-capabilities). The "&lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_portal_item.html#a25dbfe0c00befc305c215b586030febc"&gt;type&lt;/A&gt;" property will tell you &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/_a_g_s_enumerations_8h.html#aaa8f315a5ee4f4fc53e9a448e46800b8"&gt;what it represents&lt;/A&gt;. In your case you happen to know it's a FeatureService, which is great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To find out what the sublayers are, it's a bit opaque but can be done. Take the Feature Service URL (that should be accessible via portalItem.serviceURL if the portal item has loaded) and instantiate yourself an instance of &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_geodatabase_sync_task.html"&gt;AGSGeodatabaseSyncTask&lt;/A&gt;. Then call &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_geodatabase_sync_task.html#ab77285cdf36b19a70f9e0881b1498b36"&gt;loadWithCompletion()&lt;/A&gt;&amp;nbsp;on it. In the completion handler, you'll be able to read the &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_geodatabase_sync_task.html#a05dae1d3ede4b8cd8af3d34d67051c4a"&gt;featureServiceInfo&lt;/A&gt; property, which gives rich information about the FeatureService itself. Probably more than you wanted to learn about &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I feel we could expose this a little better, but it's low priority as AGSGeodatabaseSyncTask is very lightweight, does the job, and&amp;nbsp;most use-cases don't need it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know how that goes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jan 2018 15:40:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611529#M5393</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2018-01-31T15:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get feature data from a feature layer using the ArcGIS iOS SDK?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611530#M5394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That works great. Thanks again Nick!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jan 2018 23:46:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-do-i-get-feature-data-from-a-feature-layer/m-p/611530#M5394</guid>
      <dc:creator>TrevorPostma</dc:creator>
      <dc:date>2018-01-31T23:46:27Z</dc:date>
    </item>
  </channel>
</rss>

