0

我正在为 iPad/iPhone 应用程序使用 Adob​​e Air。

我还使用StageWebViewBridge( https://github.com/paleozogt/StageWebViewBridge ) 作为主要的 Web 内容显示容器。

我的应用程序适用于桌面版本,但是StageWebViewBridgeStageWebViewDisk破坏 HTML 文件上传功能:

<input id="user_avatar" name="user[avatar]" style="width:100%" type="file" />

即,无论何时从任何一个Take Photo or VideoChoose Existing从真正的 iPad 设备中浏览和选择文件,上述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)时,直接分配stageto StageWebViewBridge._view.stage,效果很好。

我不熟悉 iOS app/cache 目录。

请给我提意见。

4

1 回答 1

0

我终于想通了:

_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"; 
于 2013-03-14T20:17:28.167 回答