我有一個包含數據的方法。我想創建一個數據字符串並將其寫入文本文件。我創建了一個寫入文本方法。如何將UpLoadDeviceData方法中的NSMutableString數據獲取到我的寫入方法的字符串*內容中?這裏就是數據被拉到方法:如何獲取數據的NSMutableString並將其置於不同的字符串中?
這是我寫的文字方法:
-(void) writeToTextFile{
//get mydocuments dir
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
// System's date and timestamp
NSDate *currentDate = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MM.dd.YYYY HH:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:currentDate];
// NSLog(@"%@",dateString);
你的問題到底是什麼? – 2013-03-15 20:03:37
當你的數據已經是一個字符串時,「string that data」是什麼意思? – Desdenova 2013-03-15 20:08:35