createFileAtPath returns fail somtimes

1. the dist space is sufficient

2. it is confirmed thath the file is not existed before creating

3. after calling the createFileAtPath, it returns false, and the errno is 17, which means the file has already been existed

4. no createFileAtPath method swizzle


it seems to be a bug of ios system... do someone can help?

Replies

5. the system version is 13.3+

hi,


we'll need a little more information on this, as well as the code you're using to check available space, confirm that the file does not exist, and how you call createFile(atPath:contents:attributes:). we'd especially want to see how you set up the path.


hopefully we can say more when we see these.


hope that helps,

DMG

Step 2 could be a race condition. You may need to remove it. The only way to know if the file already exists is to try to create it and fail. You only need to check before hand if you want to keep existing data.