Instance Method インスタンスメソッド

itemAtURL:willMoveToURL:

Announces that your app is moving a file to a new URL. あなたのアプリがあるファイルを新しいURLに移動するところであるのを告知します。

Declaration 宣言

- (void)itemAtURL:(NSURL *)oldURL 
    willMoveToURL:(NSURL *)newURL;

Parameters パラメータ

oldURL

The old location of the file or directory. ファイルまたはディレクトリの古い位置。

newURL

The new location of the file or directory. ファイルまたはディレクトリの新しい位置。

Discussion 議論

This method is intended for apps that adopt App Sandbox. このメソッドは、App Sandboxを採用するアプリに対して意図されるものです。

Some apps need to rename files while saving them. For example, when a user adds an attachment to a rich text document, TextEdit changes the document’s filename extension from .rtf to .rtfd. In such a case, in a sandboxed app, you must call this method to declare your intent to rename a file without user approval. いくつかのアプリは、ファイルの名前を変更し、と同時にそれを保存することが必要です。例えば、ユーザが添付書類をリッチテキスト書類に加える場合、TextEditはその書類のファイル名拡張子を.rtfから.rtfdへ変更します。その場合には、サンドボックス化アプリでは、あなたはこのメソッドを呼び出して、あなたの意図を宣言して、ファイルをユーザ承認なしに名前変更する必要があります。

After the renaming process succeeds, call the itemAtURL:didMoveToURL: method, with the same arguments, to provide your app with continued access to the file under its new name, while also giving up access to any file that appears with the old name. 名前変更処理がうまくいった後、itemAtURL:didMoveToURL:メソッドを、同じ引数で呼び出して、あなたのアプリにそのファイルへの継続したアクセスをその新しい名前の下で提供してください、同時にまた古い名前で存在するどんなファイルへのアクセスも断念してください。

If your macOS app is not sandboxed, this method serves no purpose. This method is nonfunctional in iOS. あなたのmacOSアプリがサンドボックス化されないならば、このメソッドは用をなしません。このメソッドは、iOSでは機能しません。

See Also 参照

Coordinating File Operations Synchronously ファイル操作を同期的に協調させる(コーディネートする)