CFURLCopyResourcePropertyForKey失败,因为传递的URL没有方案 [英] CFURLCopyResourcePropertyForKey failed because passed URL no scheme

查看:2022
本文介绍了CFURLCopyResourcePropertyForKey失败,因为传递的URL没有方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序可以将文件保存到iCloud,这对iOS7很有用,但现在我在iOS8上遇到这个错误,似乎无法找到解决方法。还有其他人有这个问题吗?任何想法都将非常感激。

I have a program that saves a file to the iCloud and this has worked great for iOS7, but now I get this error with iOS8 and cannot seem to find the answer on how to fix it. Anyone else had this problem? Any ideas would be greatly appreciated.

错误:
CFURLCopyResourcePropertyForKey失败,因为它传递了这个没有方案的URL:/ var / mobile / Containers / Data / Application / ASFHDDE3-B1BB-41D7-A47C-DCC328362W21 / Documents / mypictostore.png

The Error: CFURLCopyResourcePropertyForKey failed because it was passed this URL which has no scheme: /var/mobile/Containers/Data/Application/ASFHDDE3-B1BB-41D7-A47C-DCC328362W21/Documents/mypictostore.png

代码行引发错误:
[fileManager setUbiquitous:YES itemAtURL:backupUrl destinationURL:[[ubiq URLByAppendingPathComponent:@DocumentsisDirectory:true] URLByAppendingPathComponent:backupName] error:& theError];

The Line of Code Throws Error: [fileManager setUbiquitous:YES itemAtURL:backupUrl destinationURL:[[ubiq URLByAppendingPathComponent:@"Documents" isDirectory:true] URLByAppendingPathComponent:backupName] error:&theError];

网址:
destinationURL:file:/// private / var / mobile / Library / Mobile%20Documents / ABC23455~MY-Program /
backupUrl :/var/mobile/Containers/Data/Application/ASDFGEEW-B1BB-6FR6-A47C-DCCF21876D36/Documents/mypic.png

URLS: destinationURL: file:///private/var/mobile/Library/Mobile%20Documents/ABC23455~MY-Program/ backupUrl: /var/mobile/Containers/Data/Application/ASDFGEEW-B1BB—6FR6-A47C-DCCF21876D36/Documents/mypic.png

谢谢你,
Jon

Thank you, Jon

推荐答案

对我来说,通过添加

file://

就在文件路径地址之前,如下所示:

right before the file path address like this:

var filePath = "file://\(fileURLpath)"

这篇关于CFURLCopyResourcePropertyForKey失败,因为传递的URL没有方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆