LoginSignup
1
1

More than 5 years have passed since last update.

AppGroup 内部にディレクトリを作る際のエラー

Posted at

AppGroup の共有領域内にディレクトリを作成しようとすると下記のようなエラーが出る。

Error: Unable to create directory: Error Domain=NSCocoaErrorDomain Code=513 "操作を完了できませんでした。(Cocoa エラー 513。)" UserInfo=0x15614530 {NSFilePath=file:/private/var/mobile/Containers/Shared/AppGroup/1C808679-78C6-4A2F-934B-0742817963BA/Directory, NSUnderlyingError=0x1562f730 "操作を完了できませんでした。Operation not permitted"}

その際に参照した解決法がこちら

iOS8 Unable to create a folder/file under app group shared container location

解決はしたがなぜ、pathはよくてabsoluteString はだめなのか気になったので軽く調査。
結論を言うとパスの値が微妙に違う
absoluteString はプロトコル部分も含めてパスを渡してきているが、path の方はディレクトリパスのみを渡してきている。

path
/private/var/mobile/Containers/Shared/AppGroup/1C808679-78C6-4A2F-934B-0742817963BA

absoluteString
file:///private/var/mobile/Containers/Shared/AppGroup/1C808679-78C6-4A2F-934B-0742817963BA/

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1