Select to view content in your preferred language

Local Geodatabase included in Bundle cannot be opened

4238
7
11-12-2014 02:01 AM
BeateStollberg
Deactivated User

Hi everybody,

we would like to include a local geodatabase into our iOS Application bundle.

We created the geodatabase in ArcMap 10.2.2 and are using the Runtime SDK 10.2.4.

We load the geodatabase like this:

AGSGDBGeodatabase *gdb = [[AGSGDBGeodatabase alloc]initWithPath:thePathStringGDB error:&error];

and run into the following error:

***Error Domain=com.esri.arcgis.runtime.error Code=12 "automatic extension loading failed: " UserInfo=0x17027e700 {NSLocalizedDescription=automatic extension loading failed: }

Printing description of [0].value:

  automatic extension loading failed:***

We assume that the Runtime tries to open the geodatabase in writable mode which is not possible within the bundle.

It works fine if we copy the geodatabase into the File Sharing folder of our device and load it from there.

We also tried to share the Runtime Content in ArcMap with the option "Optimize size for view only".

In this case the geodatabase could be opened from the bundle.

But a lot of (necessary) attributes from our Feature Classes were removed, so this is not an option.

Since we understand that Runtime Content shared from ArcMap should always be created as "read-only" this seems to be a bug?

Are there any solutions/workarounds?

Cheers,

Beate

0 Kudos
7 Replies
SuganyaBaskaran1
Esri Contributor

You are right with identifying the cause. We are aware of this issue, and it will be fixed with the next release.

Current workarounds are to either use iTunes File Sharing or copy the geodatabase to the documents folder of the device

-Suganya

0 Kudos
SuganyaBaskaran1
Esri Contributor

Beate,

Upon checking the bug status, it was actually fixed in 10.2.4. It appears that the symbolic link that you have in your project is causing the error. Can you try the following, and see if it resolves the issue?

- Access the test gdb inside the ArcGIS.bundle directly without the symbolic link.

NSBundle* arcgis_bundle = [NSBundle bundleWithPath:[[NSBundle mainBundle]pathForResource:@"ArcGIS" ofType:@"bundle"]];

NSString *gdbPath = [ arcgis_bundle pathForResource:@"test" ofType:@"geodatabase" inDirectory:@"test_gdb"];

(OR)

- Place the test gdb outside ArcGIS.bundle, and access it with your current code

NSString *gdbPath = [[NSBundle mainBundle]pathForResource:@"test" ofType:@"geodatabase"];

Thanks,
Suganya

0 Kudos
BeateStollberg2
Deactivated User

Dear Sugany,

(1) How can we include the geodatabase into the ArcGIS bundle? There is no way in XCode to do this (the option "Add Files to ArcGIS.bundle" is disabled in the Right-Click-Menu on ArcGIS.bundle >> see screenshot)

Screen Shot 2014-11-26 at 09.39.36.png

(2) That's what we tried before and gave the error.

Thanks,

Beate

0 Kudos
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hi Beate,

Have you tried this way to implement the gdb file?

NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *gdbPath = [paths objectAtIndex:0];
gdbPath = [gdbPath stringByAppendingPathComponent:@"your_File_Name.geodatabase"];
AGSGDBGeodatabase *gdb = [[AGSGDBGeodatabase alloc] initWithPath:gdbPath error:&error];

Let me know if this is help.

0 Kudos
BeateStollberg
Deactivated User

Hi Yue Wu,

you are suggesting to open the GDB from the Documents-Directory.

That works fine (as already stated in my original post).

We would like to include the GDB into the App-Bundle and load it from there:

        NSString *thePathStringGDB = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:C_DATABASENAME];

        NSFileManager *fileManager = [NSFileManager defaultManager];

       

        if ([fileManager fileExistsAtPath:thePathStringGDB]) {

           

            AGSGDBGeodatabase *gdb = [[AGSGDBGeodatabase alloc]initWithPath:thePathStringGDB error:&error];

           

            if (error)

                NSLog(@"Error opening gdb: %@", error.localizedDescription);

        }

This fails with the following error:

"automatic extension loading failed"

The file exists, but the loading fails.

Our workaround is now to copy the GDB from the bundle to the Library-Directory (NSLibraryDirectory) and open it from there.

Cheers,

Beate

0 Kudos
SuganyaBaskaran1
Esri Contributor

Beate,

  1. In order to include the test.gdb in bundle, right click the bundle, and "show package contents".

Screen Shot 2014-12-02 at 10.26.27 AM.png

You can then paste the gdb in.

NSString *gdbPath = [ arcgis_bundle pathForResource:@"test"ofType:@"geodatabase"];

If you are placing the gdb in a folder (within the bundle), make sure to use this method

NSString *gdbPath = [ arcgis_bundle pathForResource:@"test"ofType:@"geodatabase" inDirectory:@"test_gdb"];

Option2: This did not work because only a symbolic link is placed.

Screen Shot 2014-12-02 at 10.38.02 AM.png

The above is the screenshot from the test project submitted by support based on the bug reported, and will not work.Copying Yue Wu to confirm if that's not the case.

Please delete the link, and place the gdb instead as shown below. That should work.

Screen Shot 2014-12-02 at 10.37.44 AM.png

Can you try these, and let us know how it goes?

Thanks,

Suganya

0 Kudos
BeateStollberg
Deactivated User

Dear Suganya and Yue Wu,

(1) same error

(2) the geodatabase is not a link, it is included.

Just to be clear: In the simulator all these procedures work fine.

But on the device the geodatabase included in the bundle cannot be loaded.

Since we found a workaround (copying the geodatabase to the Library-Directory), we are not further looking for another solution.

Thanks and cheers,

Beate

0 Kudos