ios - Error Message NSData -


i need display rtf file in uitextview. code looks below:

my .h file:

@property (strong, nonatomic) iboutlet uitextview *creditstextview; 

my .m file

@synthesize creditstextview;  - (void)viewdidload {     [super viewdidload];      nsdata *creditsdata = [[nsbundle mainbundle] pathforresource:@"credits" oftype:@"rtf"];      nsattributedstring *attrstring;     nsdictionary *docattributes;      attrstring = [[nsattributedstring alloc]                   initwithrtf: creditsdata documentattributes: &docattributes]; } 

this code gives me following error messages:

at

*creditsdata : incompatible pointer types 'nsdata *' expression of type 'nsstring *' 

and @

initwithrtf : no visible @interface 'nsattributedstring' declares selector 'initwithrtf:documentattributes:' 

how can fix these 2 errors?

[[nsbundle mainbundle] pathforresource: returns type nsstring, see nsbundle class reference, cannot directly assign nsdata nsstring, can pass returned url nsdata different initialiser.

and nsattributedstring not have init method called initwithrtf. these why seeing errors.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

html - Repeat image to extend header to fill screen -

javascript - Backbone.js getting target attribute -