NSAttributedString to NSData No visible @interface for 'NSAttributedString' declares the selector 'RTFDFromRange:documentAttributes:
I am trying to convert NSAttributedString to NSData using RTFDFromRange method. Getting this: No visible @interface for 'NSAttributedString' declares the selector 'RTFDFromRange:documentAttributes: What is wrong with my code? NSAttributedString *val=self.textview.attributedText; NSData *data = [val RTFDFromRange:NSMakeRange(0, self.textview.text.length) documentAttributes:nil]; NSAttributedString does not have a method called RTFDFromRange for iOS, but only for Mac OS X. To convert NSAttributedString to NSData in iOS, you can try these two approaches: 1. Using initWithData :