Posts

Post not yet marked as solved
22 Replies
I have found a way to solve it and if someone else has the same problem: 1000-limit-error is not the same error as @logicat encountered, the problem seems to be that when iOS atomic write to a file, system first create a temporary file and then write data to it, and if the temporary file is accidentally interrupted while writing. For example, [MLModel compileModelAtURL] will temporarily create XXXX /Temp/(A Document Being Saved By yourApp)/***.mlmodelc when it is accidentally interrupted, (A Document Being Saved By ***) - temporary files will not be deleted, causing all atomic writes to fail, even if you restart your app. Try the following solve it(Language: Objective-C): 1.Use nonatomic write, e.g. [NSData writeToFile:path options:0 error:&error]; // No temporary file, nonatomic [NSData writeToFile:path atomically:NO]; [NSString writeToFile:path atomically:NO encoding:enc error:&error]; [NSDictionary writeToURL:url atomically:NO]; 2.To solve the problem completely, you need to remove the temporary file from the problem folder, which is a hidden file like ***/(A Document Being Saved By yourApp)/xxxx So I restore the atomic write ability after I clear the temporary file or temporary folder(Note: Do not delete some files generated by the system). Hope the above tips help you.
Post not yet marked as solved
22 Replies
May I add your wei xin(fang zhi he xie)? my wei xin is rock_homeboy and my dian hua hao ma is 18616309756, Im a RD of ByteDance(Douyin), and I have encountered the same problem as you mentioned above, currently contacting the user so that I can provide disk and system log diagnosis to Apple.Let me describe the problem:1.Failed to create file through NSFileManager function- (BOOL)createFileAtPath:(NSString *)path contents:(nullable NSData *)data attributes:(nullable NSDictionary<nsfileattributekey, id=""> *)attr;The error information obtained by printing errno and strerror (errno) is as follows:errorCode = 17, errorDesc = File exists.The following key file attributes are provided:{ NSFileCreationDate = "1970-01-01 00:00:02 +0000"; NSFilePosixPermissions = 493; NSFileSystemNumber = 16777222; NSFileType = NSFileTypeDirectory; }2.Can't write to file using NSData- (BOOL)writeToFile:(NSString *)path options:(NSDataWritingOptions)writeOptionsMask error:(NSError **)errorPtr; error: Error Domain=NSCocoaErrorDomain Code=512 "wei neng cun chu gai wen jian" UserInfo={NSUserStringVariant=Folder}