Hello there.
I am trying to set a property custom property to a file that I am uploading to User's folder with the name 'name' and value 'value', with teamplate '/templateId'. When I add the following I get a nil fileUrlsToBatchResultEntries and as consequence nil result, however the file is indeed uploaded to the applications' folder.
NSMutableDictionary<NSURL *, DBFILESCommitInfo *> *uploadFilesUrlsToCommitInfo = [NSMutableDictionary new];
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:localFilePath error:nil];
NSArray *propertyGroupArray = [NSArray arrayWithObjects:[[DBFILEPROPERTIESPropertyGroup alloc] initWithTemplateId:@/templateId fields:[NSArray arrayWithObjects:[[DBFILEPROPERTIESPropertyField alloc] initWithName:@name value:@value], nil]], nil];
DBFILESCommitInfoWithProperties *commitInfo = [[DBFILESCommitInfoWithProperties alloc] initWithPath:cloudFilePath mode:[[DBFILESWriteMode alloc] initWithOverwrite] autorename:[NSNumber numberWithBool:NO] clientModified:attributes[NSFileCreationDate] mute:[NSNumber numberWithBool:YES] propertyGroups:nil strictConflict:[NSNumber numberWithBool:YES]]
[uploadFilesUrlsToCommitInfo setObject:commitInfo forKey:[NSURL fileURLWithPath:localFilePath]];
[client.filesRoutes batchUploadFiles:uploadFilesUrlsToCommitInfo queue:nil progressBlock: {} responseBlock:^(NSDictionary<NSURL *,DBFILESUploadSessionFinishBatchResultEntry *> *fileUrlsToBatchResultEntries, DBASYNCPollError *finishBatchRouteError, DBRequestError *finishBatchRequestError, NSDictionary<NSURL *,DBRequestError *> *fileUrlsToRequestErrors){
DBFILESMetadata *dbFilesMetadata = nil;
DBFILESUploadSessionFinishBatchResultEntry *result = fileUrlsToBatchResultEntries[[NSURL fileURLWithPath:localFilePath]];
if (result) {
if (result.tag == DBFILESUploadSessionFinishBatchResultEntrySuccess)
dbFilesMetadata = result.success;
else
aError = [self errorFromRouteError:finishBatchRouteError requestError:finishBatchRequestError];
} else
aError = [self errorFromRouteError:finishBatchRouteError requestError:finishBatchRequestError];
success = (dbFilesMetadata != nil);
}];
What am I doing wrong when trying to set a property name and value to the file that I want to upload, please?
Looking forward to your response.