Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to write key #371

Open
HighmoreJx opened this issue Nov 4, 2016 · 2 comments
Open

Failed to write key #371

HighmoreJx opened this issue Nov 4, 2016 · 2 comments

Comments

@HighmoreJx
Copy link

[HANEKE][ERROR] Failed to write key fēng guāng-324 with error Error Domain=NSCocoaErrorDomain Code=4 "文件“fēng guāng-324”不存在。" UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/30B773AF-7416-48B0-983F-DAFACF268D3B/Library/Caches/io.haneke/shared-strings/original/fēng guāng-3*24, NSUnderlyingError=0x15f4336a0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

@greendog99
Copy link

I'm seeing the same thing, but here's some additional context. I was using HanekeSwift successfully in Swift 2.3, but when I updated my code to Swift 3.0.2 I started receiving the "Failed to write key" error. The error is below, with my actual key replaced with [mykey] and the simulator's NSFilePath shortened for readability:

[HANEKE][ERROR] Failed to write key [mykey] with error Error Domain=NSCocoaErrorDomain Code=4 "The folder “[mykey]” doesn’t exist." UserInfo={NSFilePath=[...]/Library/Caches/io.haneke/shared-json/original/[mykey], NSUserStringVariant=Folder, NSUnderlyingError=0x610000244ad0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

The NSFilePath above exists on my Mac (in the Simulator tree) only up to /Caches/io.haneke. There is no shared-json folder under it.

I'm fetching JSON data with:

let cache = Shared.JSONCache
let url = URL(string: "https://jsonplaceholder.typicode.com/posts")!
cache.fetch(URL: url).onSuccess { json in
   ...
}

I'm using Carthage, with this in my Cartfile: github "Haneke/HanekeSwift" "feature/swift-3"

I'll keep investigating, but hopefully this additional info will help tracking this down.

@greendog99
Copy link

OK, I've determined that this only happens for me after I run Shared.JSONCache.removeAll(). That seems to match the problem reported in issue #245 (Failed to write key with error) so these two issues may be the same. The removeAll() was working fine in Swift 2.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants