I need to save an NSDictionary in Backendless. Because there is no support for saving such a piece of data (or an array), I am attempting to convert the NSDictionary to NSData using JSON Serialization then save the NSDate to a json file in Backendless. There is no trouble until that last part. I cannot successfully save the .json file to Backendless.
My code is as follows:
NSString *convoStatusDictName = [NSString stringWithFormat:@"%@-ConvoStatusDict.json", currentUser.objectId];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"testObject", @"testKey", nil];
NSError *error = nil;
NSData* jsonData = [NSJSONSerialization dict options:NSJSONWritingPrettyPrinted error:&error];
[backendless.fileService upload:convoStatusDictName content:jsonData response:^(BackendlessFile *convoStatusDictFile)
{
// blah blah blah
} error:^(Fault *fault) {
NSLog(@"fault saving convos file: %@", fault);
}];
This is causing the following error:
Server reported an error (ASYNC): FAULT = ‘1007’ [Unable to save object - invalid data type for properties - convoStatusDict. You can change the property type in developer console.] <Unable to save object - invalid data type for properties - convoStatusDict. You can change the property type in developer console.>
I have no problem saving a .jpeg file, but this is clearly different and is not working. Thanks!