xcode:13.1
macOS:12.1
有人可以帮我解答吗?谢谢
Hi Jack,
`AGSItem` is the base class for portal item and local item: https://developers.arcgis.com/ios/api-reference/interface_a_g_s_item.html , so you cannot directly initialize that.
Can you explain what is your usecase for initializing a local item? It might come with some local map packages, but I didn't encounter a case that it needs to be instantiated.
You may want to initialize an `AGSPortalItem` instead, if you want to access a resource from ArcGIS Online or Enterprise.
You can refer to this snippet to configure a portal item: https://github.com/Esri/arcgis-runtime-samples-ios/blob/3fbca3cd60a87ec15f0df0c0f55531e62d0ee911/arcgis-ios-sdk-samples/Features/Feature%20collection%20layer%20(portal%20item)/FeatureCollectionLayerFromPortalViewController.swift#L36
Say you have a public web map on AGOL, use the following snippet to access it.
let map = AGSMap(item: AGSPortalItem( portal: .arcGISOnline(withLoginRequired: false), itemID: "{your-webmap-id}" ))
Hope it helps!
P.S. please ask the question in English when possible, so that other folks can better help you 🙂
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.