我也是刚接触arcgis的,在加载完geodatabase后,想获取里面的具体字段和信息时出现这个错误

ArcGIS Runtime Error Ocurred. Set a breakpoint on C++ exceptions to see the original callstack and context for this error:  Error Domain=com.esri.arcgis.runtime.error Code=15 "Cannot call this method in this context" UserInfo={Additional Message=Can only call this method on a loaded table., NSLocalizedFailureReason=Can only call this method on a loaded table., NSLocalizedDescription=Cannot call this method in this context}
已邀请:

马克玲

赞同来自: 你好,阳光

 从报错信息来看,是在 geodatabase未完成初始化时,程序就试图访问geodatabase中的表,所以报了上述错误。对于geodatabase,可以调用loadWithCompletion:方法,在这个回调函数中,实现geodatabase的查询。以下是100.0.0的示例:
 
self.geodatabase = AGSGeodatabase(name: "")
geodatabase.load(completion: {[weak self] (error)-> Void in
        if let error = error {
               print("\(error)")
            }else{           
                guard let weakSelf = self else{
                    return
                }
            let featureTable = weakSelf.geodatabase.geodatabaseFeatureTable(withName: "")
            }
        })
 

要回复问题请先登录注册