Hello,
I’m having issue with AGSServiceFeatureTable queryFeatures function, when I call it I get the error bellow.
I’m running a simple query like this:
class ViewController: UIViewController {
private var featureTable: AGSServiceFeatureTable = {
let featureTable = AGSServiceFeatureTable(url: url)
}()
override func viewDidLoad() {
super.viewDidLoad()
self.fetchFeatures()
}
private func fetchFeatures() {
}
}
ArcGIS Runtime Error Occurred. Set a breakpoint on C++ exceptions to see the original callstack and context for this error: Error Domain=com.esri.arcgis.runtime.error Code=1014 "Unable to open the database file" UserInfo={NSLocalizedFailureReason=, NSLocalizedDescription=Unable to open the database file, Additional Message=}
Some help would be great!
Thank you
Solved! Go to Solution.
Or, I wonder if the featureTable is going out of scope before the queryFeatures() call can return. Are you seeing the error in the console or is that actually being returned to the completion block?
Try making featureTable an instance variable/property on the class.
Can you share the layer URL? Is it publicly accessible for us to test against?
Or, I wonder if the featureTable is going out of scope before the queryFeatures() call can return. Are you seeing the error in the console or is that actually being returned to the completion block?
Try making featureTable an instance variable/property on the class.
I updated the original post with code how I actually use it.
Thanks. Sounds like some in-memory feature table backing store is being deallocated when you dismiss the view controller. Can you add some error checking into your callback and see what the "error" provides? It might just reflect what you're seeing in the console, but you should be checking that at code level as a best practice anyway.
I do check the error at runtime of course, but for sake of simplicity I didn't include the error handling here.
Unfortunately the completion block is not even invoked after the error above.
In that case…
Also, as asked before, are you able to share the feature service URL?
1. The completion block is not even invoked after the error, so I can't say that is the same or not.
2.Yes, here it is.
3.1. Yes everything is being reconstructed.
3.2. No MapView only AGSServiceFeatureTable.
3.3. Yes I'm recreating it every time the view controller is pushed, and its not helping.
4. I planned to lower the timeout when resource is not available, 60 seconds it's too much.
I will try to send you the feature layer url, I don't know if I'm allowed to share it publicly.
Thanks.
If the completion block is not being called (sorry - I missed this in your last reply), it certainly seems the AGSServiceFeatureTable must be getting deallocated and going out of scope. You should either get a result or an error. Is the view controller being dismissed while the query is in process?
Could you provide a simple reproducer app so we can look into it?
The URL could be helpful but at this point I think it's likely this could be reproducible with any service.
BTW, for the c++ exception, we'd want to see the stack trace.
After long debugging, I discovered what is the problem, I will try to explain as short as possible.
This view controller has an WTArchitectView from Wikitude SDK for AR functionality, and unfortunately somehow it deallocates the AGSServiceFeatureTable. Probably some memory issues in their sdk.
So now I'm querying the features before presenting this view controller, and everything is working as expected.
Thank you for your time and help.