I'm able to pass extremely long strings with stringByEvaluatingJavaScriptFromString
, so I doubt that is the problem. (Note I'm writing for osx, not ios which might make a difference)
It might be that your are not escaping the html correctly so it's being passed as invalid javascript, which could cause nothing to happen. I'm doing the following to a string before passing it to javascript:
content = [content stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
content = [content stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"];
content = [content stringByReplacingOccurrencesOfString:@"\r" withString:@""];
NSString *js = [NSString stringWithFormat:@"set_content(\"%@\")", content];
[ web_view stringByEvaluatingJavaScriptFromString: js ];
I don't know if all of that is necessary or either it could be written more succinctly (I'm very new to objective c), but it seems to work fine for me.