objective c - How to save a locally loaded HTML file in UIWebview -
i writing rich text editor using uiwebview. this, used template file starter.
then when user finishes editing has not published yet, save current content back-up html file in case app corrupts.
how do that?
here go... buddy
nsfilehandle *file; nsmutabledata *data; const char *bytestring = "black dog";//in case html string here data = [nsmutabledata datawithbytes:bytestring length:strlen(bytestring)]; nsstring *path = //path html file if ([filemgr fileexistsatpath:path] == yes){ nslog (@"file exists"); file = [nsfilehandle filehandleforupdatingatpath:path]; if (file == nil) nslog(@"failed open file"); [file writedata: data]; [file closefile]; } else nslog (@"file not found");
complete tutorial below
Comments
Post a Comment