我試圖檢查響應時間與下載一些圖像文件..所以我使用ASIHTTPRequest [request temporaryFileDownloadPath];iOS ASIHTTPRequest [request temporaryFileDownloadPath];會自動下載文件並擦除?
它會下載文件在臨時目錄中的iPhone並自動清除它?
我試圖檢查響應時間與下載一些圖像文件..所以我使用ASIHTTPRequest [request temporaryFileDownloadPath];iOS ASIHTTPRequest [request temporaryFileDownloadPath];會自動下載文件並擦除?
它會下載文件在臨時目錄中的iPhone並自動清除它?
temporaryFileDownloadPath
是在下載過程中放置文件的位置。下載後,它將從那裏複製到downloadDestinationPath
的位置。如果您將downloadDestinationPath
設置爲NSTemporaryDirectory()
,則該文件將在某個時刻被系統自動刪除。
如果您想立即刪除文件,只需不要設置downloadDestinationPath
或temporaryFileDownloadPath
,它會保留在內存中,然後在請求超出範圍時解除分配。如果圖像太大而不適合內存,請在某處設置一個downloadDestinationPath
(只要是有效的,則無關緊要),然後在下載完成後使用[[NSFileManager defaultManager] removeItemAtPath:[request downloadDestinationPath] error:nil]
從磁盤中刪除該文件。將NSError*
傳遞給error
參數以檢查刪除是否遇到錯誤。
你知道會發生什麼,如果我只是使用[request temporaryFileDownloadPath]; ?看起來它工作正常.. – MomentH
嗯,我不得不看看代碼,但如果'![self downloadDestinationPath]'(如果你還沒有設置下載路徑),它不會保存到臨時文件,即使臨時路徑被設置。 – darvids0n
這是否意味着它的下載並沒有保存在任何地方? – MomentH