我使用下面的方法寫的圖像文件輸出到應用程序/文件夾訪問一個文件:目標C - 如何從iPhone /應用程序/文件
- (void)saveImage:(UIImage *)image toFile:(NSString *)fileName
{
//get the data from the representation
NSData * binaryImageData = UIImagePNGRepresentation(image);
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
//write the data to a file
[binaryImageData writeToFile:[basePath stringByAppendingPathComponent:fileName] atomically:YES];
}
我以爲我可以把它們複製到我的電腦,但那不適合我。然後,我決定嘗試將文件寫入我的硬盤。不。我想這也是一個愚蠢的想法。
我正在處理位圖圖像,我只是想捕獲某處(不在設備),然後我可以檢索它們進行測試。我已經用這幾個小時搗爛了,現在已經很晚了,我很累。絕對準備好一點幫助。
預先感謝您。
如果您想使用設備圖像傳輸到計算機
是否要將文件從iPhone/iPad複製到計算機上? – jsedano
是的,請!!!謝謝。 :-) – Patricia
[[NSFileManager defaultManager] copyItemAtURL:originURL toURL:saveURL error:NULL];你用過這個 – morroko