I made a code that allows to write lines a txt file. On the Xcode simulator the writing works fine but I installed the application on my iPhone and the writing does not work. Below there is the code that allows to write the lines. I created several NSString that I then put together in a global NSString.
-(void)write_simpletxt{
NSString *masse_totale_value_equipage = [[NSUserDefaults standardUserDefaults] stringForKey:@"masse_totale_value_equipage"];
NSString *carburant_equipage = [[NSUserDefaults standardUserDefaults] stringForKey:@"carburant_equipage"];
float carburant = [carburant_equipage floatValue];
float masse = [masse_totale_value_equipage floatValue];
NSURL *url = [self generateFileURL:self.documentName];
NSString *title = @"/* PLANE CALCULATEUR */\n\n/* RAPPORT CALCULS SIMPLE*/\n\n";
NSString *value = [NSString stringWithFormat:@"masse totale: %.0fKg. \nCarburant utile: %.0f\n", masse, carburant];
NSString *complete = [NSString stringWithFormat:@"%@%@", title,value];
[complete writeToURL:url atomically:YES encoding:NSStringEncodingConversionAllowLossy error:nil];
}
I think it's a problem of the number of bytes.