How to convert HTML NSData to NSString?

I am using [NSData dataWithContentsOfURL:] to create two instances of NSData, and I want to compare these instances to determine how different they are. Since they are both from the same website, using the string to search for something different will help me highlight the actual elements that have (been) changed. Can I change this data to a string to find the difference?

+4
source share
2 answers

Try the initWithData:encoding: NSString method to create a string with your data.

Exmp: NSString *str = [[NSString alloc] initWithData:someData encoding:NSUTF8StringEncoding]

+10
source
+1
source

All Articles