5

我正在使用HJCachelib 在我的 iPhone 应用程序中缓存图像。

我收到以下错误,但不是所有图像,只是第一个(不)出现。

HJMOFileCache未能将加载文件移动到就绪文件/Users/joao__garcia/.../Library/Caches/imgcache/ready/http:__uni.....jpg

以下图像加载没有问题。有人知道发生了什么事吗?

我以这种方式获取目录:

    objMan = [[HJObjManager alloc] init];
    NSString* cacheDirectory = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/imgcache"] ;
    HJMOFileCache* fileCache = [[HJMOFileCache alloc] initWithRootPath:cacheDirectory];
    objMan.fileCache = fileCache;

接着:

managedImage = [[HJManagedImageV alloc] initWithFrame:CGRectMake(96, 88, 185, 167)];

managedImage.url = [NSURL URLWithString:[NSString stringWithFormat:@"http:...",video.thumb_video]];
NSLog(@"%@", managedImage.url);

[objMan manage:managedImage];

//    [objMan performSelectorOnMainThread:@selector(manage:) withObject:managedImage waitUntilDone:YES];
NSLog(@"image %@", managedImage.image);
[managedImage sizeToFit];
playVideoViewButton.backgroundColor = [UIColor colorWithPatternImage:managedImage.image];
4

1 回答 1

0

我不能肯定地告诉你问题出在哪里,但我会就如何确定问题所在提供一些建议。

查看第 128 行的“HJCacheClasses/HJMOFileCache.m”文件:

[[NSFileManager defaultManager] moveItemAtPath:loadingFilename toPath:readyFilename error:&e];

没有任何东西可以捕获并显示错误,因此在该行添加一个断点,当它失败时,您应该能够看到“e”错误在说什么。如果您可以将其包含在您的问题中,我也许可以告诉您问题所在。

于 2012-12-06T12:43:07.813 回答