Save and Update HTML form in iOS

Viewed 101

I need to save HTML form in document directory after editing some of its parts like textfield,dropdown value so that when a user opens HTML form in offline mode he can edit that form as per his need then can update the form as well.I am showing this HTML form on WKWebView.

In short I need to save with all the filled fields.

Code snippet to store HTML form:

//use this data to write to any path as documentdirectory path + filename.html
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    //create file path
    NSString *htmlFilePath = [documentsDirectory stringByAppendingPathComponent:[[[NSString stringWithFormat:@"%f",RecordId] stringByAppendingFormat: @"%@", FormTitle]stringByAppendingFormat:@".html"]];
    //write at file path
    BOOL isSucess = [data writeToFile:htmlFilePath atomically:YES];
    if (isSucess)
        NSLog(@"written");
    else
        NSLog(@"not written");

I got stuck in this scenario.Please help

0 Answers
Related