StageWebViewDisk Breaks the File Upload on iPad (iOS?)

我的梦境 提交于 2019-12-12 02:24:39

问题


I'm using Adobe Air for iPad/iPhone application.

I'm also using StageWebViewBridge (https://github.com/paleozogt/StageWebViewBridge) as the main web content displaying container.

My application works well for the Desktop version, but the StageWebViewBridge's StageWebViewDisk breaks HTML File Uploading feature:

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

i.e., whenever a file is browsed and selected from either Take Photo or Video or Choose Existing from the real iPad device, the above user_avatar input does NOT get updated at all.

I believe some paths are messed up by StageWebViewDisk.initialize(stage).

You can find the full source of StageWebViewDisk here: https://github.com/paleozogt/StageWebViewBridge/blob/master/StageWebViewBridge/src/es/xperiments/media/StageWebViewDisk.as

And the following code snippet is very suspicious:

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;

I debugged a lot, and I finally found out that StageWebViewDisk.initialize(stage) is causing issue.

The proof is that, when I don't use StageWebViewDisk.initialize(stage), instead, directly assign the stage to StageWebViewBridge._view.stage, it works very well.

I'm not familiar with the iOS app/cache directories.

Please advise me.


回答1:


I finally figured it out:

_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/stagewebviewdisk-breaks-the-file-upload-on-ipad-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!