Skip to content

Instantly share code, notes, and snippets.

@hasyimibhar
Created April 1, 2013 02:40
Show Gist options
  • Save hasyimibhar/5282951 to your computer and use it in GitHub Desktop.
Save hasyimibhar/5282951 to your computer and use it in GitHub Desktop.
Convert NSDictionary to XML string
- (NSString *)convertToXml:(NSDictionary *)dictionary {
NSMutableString *xmlString = [[NSMutableString alloc] init];
for (NSString *key in [dictionary allKeys]) {
id value = [dictionary objectForKey:key];
[xmlString appendFormat:@"<%@>%@</%@>\n", key, value, key];
}
return [NSString stringWithString:xmlString];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment