I made an app which writes text using "writeToURL" on a txt file attached to the resources. When I load the app on the simulator it writes the text you entered, but when you launch the app on the device it writes nothing. If you have something written on the txt file, the app loaded on the device shows it, but it can´t overwrite it, as the simulator does... what can be wrong? Thx! The code (iOS Objective C):
-(IBAction)cargarALaWeb:(id)sender{
if ([_texto.text isEqualToString:[NSString stringWithFormat:@""]]) {
[_web1 loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://contactonotpad.wix.com/inicio#!ayuda-con-cargar-en-la-web/ak5ig"]]];
}
else{
NSString *textofile=_texto.text;
[textofile writeToURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"web" ofType:@"html"]] atomically:YES encoding:NSUTF8StringEncoding error:nil];
NSLog(@"Escrito");
[_web1 loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"web" ofType:@"html"]]]];
}
}
`