我正在使用Adobe Air for iPad/iPhone应用程序。
我还使用StageWebViewBridge (https://github.com/paleozogt/StageWebViewBridge)作为主要的web内容显示容器。
我的应用程序在桌面版上运行得很好,但StageWebViewBridge的StageWebViewDisk破坏了HTML文件上传功能:
<input id="user_avatar" name="user[avatar]" style="width:100%" type="file" />即,每当从实际iPad设备的Take Photo or Video或Choose Existing中浏览和选择文件时,上述user_avatar输入根本不会被更新。
我相信一些路径被StageWebViewDisk.initialize(stage)搞乱了。
你可以在这里找到StageWebViewDisk的完整源代码:https://github.com/paleozogt/StageWebViewBridge/blob/master/StageWebViewBridge/src/es/xperiments/media/StageWebViewDisk.as
下面的代码片段非常可疑:
case isIPHONE :
/* new iOS 5.0 Data Storage Guidelines
* https://developer.apple.com/icloud/documentation/data-storage/
* https://developer.apple.com/library/ios/#qa/qa1719/_index.html
*/
_appCacheFile = new File(File.applicationDirectory.nativePath +"/\.\./Library/Caches");
_applicationCacheDirectory = new File( _appCacheFile.nativePath ).url;
_applicationRootPath = _applicationCacheDirectory + '/' + getWorkingDir();
_applicationSourcesDirectory = new File( new File( "app:/" + _document_root ).nativePath ).url;
_appDocsDirectory = File.documentsDirectory.url;
/* new iOS 5.0 Data Storage Guidelines
* https://developer.apple.com/icloud/documentation/data-storage/
* https://developer.apple.com/library/ios/#qa/qa1719/_index.html
*/
_applicationTempDir = new File(File.applicationDirectory.nativePath +"/\.\./tmp");
// To acomplish the Apple Data Storage Guidelines Rules delete our TMP files dir at exit
NativeApplication.nativeApplication.addEventListener(Event.EXITING, deleteTempFolder,false,0,true );
NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, deleteTempFolder, false, 0, true);
break;我调试了很多,最后我发现是StageWebViewDisk.initialize(stage)导致了问题。
证据是,当我不使用StageWebViewDisk.initialize(stage),而是直接将stage赋值给StageWebViewBridge._view.stage时,它工作得很好。
我不熟悉iOS应用程序/缓存目录。
请给我提个建议。
发布于 2013-03-15 04:17:28
我终于想通了:
_applicationTempDir = new File(File.applicationDirectory.nativePath +"/\.\./SWVBTmp");
// It seems "tmp" is being used by the iOS system (such as the html file upload), so we changed to "SWVBTmp"; https://stackoverflow.com/questions/15306461
复制相似问题