iPh*_*sor 1 macos xcode cocoa nsfilemanager
我使用NSFilemanager类检查我的Mac OS文件夹中是否存在文件.fileExistsAtPath总是失败...帮我找错.谢谢
NSURL* finalImageURL;
NSURL* imageURL = [[plistURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"png"];
NSLog(@"Path: %@\n",imageURL.absoluteString); //Prints Path: /Users/MacAdmin/Desktop/gameover/sheet/SpriteSheet_GameOver-ipadhd.png
if ([[NSFileManager defaultManager] fileExistsAtPath:imageURL.absoluteString])
{
printf("Exists\n");
}
Run Code Online (Sandbox Code Playgroud)
小智 7
打印
Path: /Users/Gururaj/Desktop/gameover/sheet/SpriteSheet_GameOver-ipadhd.png
你确定吗?您似乎正在尝试使用URL的绝对字符串表示形式以及file://其开头的架构.尝试absoluteString改为path.
| 归档时间: |
|
| 查看次数: |
2048 次 |
| 最近记录: |