Quantcast
Channel: 技術者のたまごブログ
Viewing all articles
Browse latest Browse all 68

ファイルコピーの[NSData dataWithContentsOfURL:]で落ちる

$
0
0
ShareExtensionでファイルをコピーするサンプルの多くが

[NSData dataWithContentsOfURL:];

でコピーしていたので、それにのっとってコピーしていたのだが、巨大なファイルだとこれではメモリ不足で落ちる。

代わりに


NSFileManager *filemgr;
filemgr = [NSFileManager defaultManager];
[filemgr copyItemAtPath:[newURL path] toPath:dstPath error: &error];

とすると良い

Viewing all articles
Browse latest Browse all 68

Trending Articles