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"]; } }];
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=}
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
Solved! Go to Solution.
AGSGDBGenerateParameters *params = [[AGSGDBGenerateParameters alloc] initWithFeatureServiceInfo:self.gdbTask.featureServiceInfo]; params.syncModel = AGSGDBSyncModelPerGeodatabase; ...