I'm trying to download a file in Objective-C from a REST service but having some issues. Right now, the service returns a byte[] in JSON. I was able to get the array by using the json-framework.
NSURL *url = [NSURL URLWithString:@"http://192.168.10.215:8888/Service/RO/GetAllTheBytes/test.txt"];
NSString *str = [[NSString alloc] initWithContentsOfURL:url];
NSDictionary *jsonDic = [str JSONValue];
NSArray *fileContents = [jsonDic objectForKey:@"fileContents"];
Now I want to use this array of bytes to create a file, but I'm having trouble creating the file. Should I convert the NSArray
to NSData
, and how?