Error generating geodatabase, cryptic response

4040
4
Jump to solution
05-05-2014 04:29 PM
JamesRichards1
Occasional Contributor
Hi,

I modified (simplified) the OfflineEditingSample to try and generate a geodatabase from one of our Feature Services. I'm just trying to generate the geodatabase file and download it. Once I have that working I can move on to more fun stuff. Here is the code (lifted from the sample):

    AGSGDBGenerateParameters *params = [[AGSGDBGenerateParameters alloc] initWithFeatureServiceInfo:self.gdbTask.featureServiceInfo];     params.extent = self.mapView.visibleAreaEnvelope;     params.outSpatialReference = self.mapView.spatialReference;     NSArray* layers = @[@(1)]; // Just getting one layer for testing     params.layerIDs = layers;          [SVProgressHUD showWithStatus:@"Preparing to download"];     [self.gdbTask generateGeodatabaseWithParameters:params downloadFolderPath:nil useExisting:YES status:^(AGSResumableTaskJobStatus status, NSDictionary *userInfo) {                  //If we are fetching result, display download progress         if (status == AGSResumableTaskJobStatusFetchingResult) {             NSNumber* totalBytesDownloaded = userInfo[@"AGSDownloadProgressTotalBytesDownloaded"];             NSNumber* totalBytesExpected = userInfo[@"AGSDownloadProgressTotalBytesExpected"];             if(totalBytesDownloaded != nil && totalBytesExpected != nil){                 double dPercentage = (double)([totalBytesDownloaded doubleValue]/[totalBytesExpected doubleValue]);                 [SVProgressHUD showProgress:dPercentage status:@"Downloading features"];             }         } else {             //don't want to log status for "fetching result" state because             //status block gets called many times a second when downloading.             //we only log status for other states here             NSLog(@"Status: %@", AGSResumableTaskJobStatusAsString(status));         }     } completion:^(AGSGDBGeodatabase *geodatabase, NSError *error) {         if (error) {             NSLog(@"error generating geodatabase: %@", error);             [SVProgressHUD showErrorWithStatus:@"Error downloading features"];         } else {             NSLog(@"downloaded geodatabase: %@", geodatabase.path);             [SVProgressHUD showSuccessWithStatus:@"Finished downloading"];         }     }];


Several status events are logged and eventually the completion block fires with an error. The NSLog output to the console looks like this:

Status: Waiting for default parameters Status: Pre-processing job Status: Starting job Status: Polling Status: Polling Status: Polling Status: Polling Status: Polling Status: Done error generating geodatabase: Error Domain=NSCocoaErrorDomain Code=400 "The operation couldn???t be completed. " UserInfo=0x14f4f860 {NSURL=http://xxxxxxxx:6080/arcgis/rest/services/ElectricDistribution/FeatureServer/jobs/j51fbc2858ae648d89478daa6bd27b32b?f=json, responseJSON={     error =     {         code = 400;         description = "";     };     lastUpdatedTime = 1399335065000;     replicaName = "Ags_Fs";     resultUrl = "";     status = Failed;     submissionTime = 1399335050000; }, NSLocalizedFailureReason=}


Note: I replaced the location of the server in the error message with xxxxxxxx. It is hidden behind a firewall and access is occurring over a VPN.

Can anyone shed some light on the error message. It's not telling me much.

Also note: here are the Sync Capabilities on the Feature Service:

Sync Capabilities: Supports Registering Existing Data: true Supports Sync Direction Control: true Supports PerLayer Sync: false Supports PerReplica Sync: true Supports RollbackOnFailure : false Supports Async: true


Thanks in advance,
James
0 Kudos
1 Solution

Accepted Solutions
SuganyaBaskaran1
Esri Contributor
Editing is not currently allowed for versioned data. So while publishing, make sure to unselect "Create", "Update", "Delete" options (Only "Query" & "Sync" should be). After the service is published, this can be verified by "Supported Operations" on the layer. It should not include "Add Features","Update Features","Delete Features","Apply Edits". Can you confirm what's in there?

This section has more info on creating offline content for versioned and non-versioned data

View solution in original post

0 Kudos
4 Replies
SuganyaBaskaran1
Esri Contributor
Can you confirm the syncModel property of your AGSGDBGenerateParameters is perReplica? Also, is your data versioned?
0 Kudos
JamesRichards1
Occasional Contributor
Hi,

Thanks for your reply.

At one point I added a line to explicitly set the syncModel property of the params to AGSGDBSyncModelPerGeodatabase:

AGSGDBGenerateParameters *params = [[AGSGDBGenerateParameters alloc] initWithFeatureServiceInfo:self.gdbTask.featureServiceInfo];
params.syncModel = AGSGDBSyncModelPerGeodatabase;
...


This didn't seem to make any difference so I removed that line.

The data is versioned.

Cheers,
James
0 Kudos
SuganyaBaskaran1
Esri Contributor
Editing is not currently allowed for versioned data. So while publishing, make sure to unselect "Create", "Update", "Delete" options (Only "Query" & "Sync" should be). After the service is published, this can be verified by "Supported Operations" on the layer. It should not include "Add Features","Update Features","Delete Features","Apply Edits". Can you confirm what's in there?

This section has more info on creating offline content for versioned and non-versioned data
0 Kudos
JamesRichards1
Occasional Contributor
Modifying the FeatureService to only allow Query and Sync solved the issue. Thank you.

Cheers,
James
0 Kudos