I’m trying to utilize a class from the Google Toolbox for Mac libraries, for unescaping HTML text. Specifically, I’m using GTMNSString+HTML.h and GTMNSString+HTML.m.
Where I’m trying to escape the text, I’m doing this:
NSString *escaped = [ gtm_stringByEscapingForHTML:_item.body ];
But when I try to compile I’m getting an error:
'gtm_stringByEscapingForHTML' undeclared (first use in this function)
I understand that this means I need to declare something earlier in my file, but I’m not sure where, and beyond that what the syntax would be.
Any help is greatly appreciated, thank you.
First, make sure you’re including
GTMNString+HTML.hin your implementation file.Second, that file defines a category on NSString, so it’s methods become methods of NSString objects. You would invoke it like this:
You can learn more about categories here: https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocCategories.html.