[問題] 利用writeTofile將一個object寫入file
請問有大大嘗試過
利用writeToFile將一個Object寫入file內嗎?
-(void) writeToFile:(Squiggle *) text withFileName:(NSString *) filePath {
[arrayForWritedSquiggle addObject:text];
[arrayForWritedSquiggle writeToFile:filePath atomically:YES];
[arrayForWritedSquiggle release];
}
上面是function部分
arrayFroWritedSquiggle我宣告成全域變數,
Squiggle是我想要寫的object,filepath是我想寫入的路徑檔名
[self writeToFile:squiggle withFileName:fileName];
然後我再移除squiggle之前我講他寫入file內,
我的問題是,我之前將squiggle裡面的東西一個一個轉成string可以存
但我現在想要像在java上面一樣直接存整個object內容
請問我該怎麼處理呢?
謝謝大家~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.28.118
→
06/01 23:25, , 1F
06/01 23:25, 1F
→
06/02 00:38, , 2F
06/02 00:38, 2F
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章