Solved! Go to Solution.
I am using the following swift code to load a database which is more than 20 MB in size. This code works perfectly on simulator, but not on the iPad. A smaller sized database (<5MB) could be loaded on the device.
var gdb = AGSGDBGeodatabase();
do{
print(gdbPath)
//try localGDB = AGSGDBGeodatabase(path: gdbPath)
try gdb = AGSGDBGeodatabase.init(path: gdbPath)
//Add layers from local database
for featureTable in gdb.featureTables() as! [AGSFeatureTable] {
if featureTable.hasGeometry() {
self.mapView.addMapLayer(AGSFeatureTableLayer(featureTable: featureTable))
}
}
}catch let error1 as NSError{
print("Error is - \(error1)")
}
How are you creating gdbPath? If it is the documents path keep in mind that this is unique for each session on the device. The app runs under a different instance ID each time so you should get the path to the documents directory using something like this:
NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! NSString