AIR:OSX 上的 securityError(但不是在 Windows 上)与 URLStream() [英] AIR: securityError on OSX (but not on Windows) with URLStream()

查看:23
本文介绍了AIR:OSX 上的 securityError(但不是在 Windows 上)与 URLStream()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 URLStream 从硬盘加载文件(我想继续使用 URLStream 来执行此操作).该文件位于app-storage:/myfolder/myFile.zip"

I'm using URLStream to load a file from the harddisk (and I'd like to continue to use URLStream to do so). The file is located in "app-storage:/myfolder/myFile.zip"

所以我用

var f:File = new File("app-storage:/myfolder/myFile.zip");
myStream.load(new URLRequest(f.nativePath));

在 Windows 上,这似乎可以正常工作 - 但在 OS X 上,URLStream 会发送带有消息的 SecurityErrorEvent.SECURITY_ERROR:

on Windows this seems to work without problems - but on OS X the URLStream dispatches a SecurityErrorEvent.SECURITY_ERROR with the message:

Error #2032: Stream Error. URL: app:/Users/myUserName/Library/Preferences/MyAppName/Local%20Store/myfolder/myFile.zip

谁能解释一下为什么这适用于 Windows 而不适用于 OS X 以及如何解决此问题?

can someone explain me why this works on windows but not on OS X and how to resolve this issue?

推荐答案

2032 好老,模棱两可的错误!

Good old, ambiguous error 2032!

您可能想尝试:

var f:File = new File(File.applicationStorageDirectory + "/myFolder/myFile.zip");

编辑

我最初的评论是使用 File.applicationStorageDirectory 属性,我仍然认为这是一个好主意.但看起来该属性归结为您正在使用的相同字符串......所以也许问题在于存储目录的位置已更改并且您要查找的文件仍在原始位置?请参阅下面的链接.

My original comment was to use the File.applicationStorageDirectory property, and I still think that's a good idea. But it looks like that property boils down to the same string that you are using ... so perhaps the problem is that the location of the storage dir has changed and the file you are looking for is still in the original location? See link below.

结束编辑

注意此处的评论 关于仅在 Mac OSX 的 Air 3.3 中对此路径所做的更改.即使这不能解决您的问题,如果路径更改或某些其他设备/操作系统需要不同的架构",使用此属性应该可以保护您的代码免受未来问题的影响.

Note the comment here about a change made to this path in Air 3.3 for Mac OSX only. Even if this doesn't fix your problem, using this property should shield your code from future problems if the path changes or a different "schema" is needed for some other device/OS.

这篇关于AIR:OSX 上的 securityError(但不是在 Windows 上)与 URLStream()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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