get XML format of NSDictionary and send in NSData



I have NSDictionary with BOOL and NSString,



NSString *enteredText = [[NSString alloc] initWithString:enterTextField.text];
BOOL switchSelected = switchControl.on;

NSDictionary *dictionaryToSend = [[NSDictionary alloc] initWithObjectsAndKeys:enteredText, @"text", [NSNumber numberWithBool:switchSelected], @"switch", nil];


I need to make them in XML format and then send them through web socket in NSData format, cause SocketRocket library has method:



// Send a UTF8 String or Data.
- (void)send:(id)data;


I stuck on this question. I found a XMLDictionary library on gitHub but it doesn't help me to solve this question. How should I do this?


No comments:

Post a Comment