加载文件时应用崩溃> iPad上有256MB

时间:2014-07-21 14:34:24

标签: ios ipad cordova

我无法理解崩溃应用程序的原因是什么。如果有人遇到同样的问题,请告诉我。

Cordova 3.5.0
插件版本:
FileTransfer 0.4.4
档案1.2.0
InAppBrowse 0.5.0

iPad 2版本7.1.2
上传文件时出错iOS> 256MB

记录设备:

Jul 21 18:17:01 iPad-Sergej MyApp[160] <Warning>: CDVWebViewDelegate: Navigation started when state=1
Jul 21 18:17:01 iPad-Sergej MyApp[160] <Warning>: Failed to load webpage with error: CDVWebViewDelegate: Navigation started when state=1
Jul 21 18:17:01 iPad-Sergej MyApp[160] <Warning>: THREAD WARNING: ['File'] took '68.479980' ms. Plugin should use a background thread.
Jul 21 18:17:01 iPad-Sergej MyApp[160] <Error>: MyApp(160,0x3b50818c) malloc: *** mach_vm_map(size=408289280) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Jul 21 18:17:01 iPad-Sergej MyApp[160] <Error>: *** Terminating app due to uncaught exception 'NSFileHandleOperationException', reason: '*** -[NSConcreteFileHandle readDataOfLength:]: Cannot allocate memory'
*** First throw call stack:
(0x2e49af83 0x38f81ccf 0x2e49aec5 0x2ee49931 0x2ee49fe3 0xceee7 0xd1a8d 0xbcd09 0xbc9ff 0x2ee7b163 0x2e466167 0x2e465d7f 0x2e46411b 0x2e3ceebf 0x2e3ceca3 0x332c9663 0x30d1b14d 0xbffb7 0x3948eab7)
Jul 21 18:17:01 iPad-Sergej ReportCrash[161] <Notice>: ReportCrash acting against PID 160
Jul 21 18:17:02 iPad-Sergej ReportCrash[161] <Notice>: Formulating crash report for process MyApp[160]
Jul 21 18:17:02 iPad-Sergej mediaserverd[45] <Warning>: 18:17:02.266 [0x5ee000] CMSession retain count > 1!
Jul 21 18:17:02 iPad-Sergej com.apple.launchd[1] (UIKitApplication:com.MyApp[0xd3ac][160]) <Warning>: (UIKitApplication:com.MyApp[0xd3ac]) Job appears to have crashed: Abort trap: 6
Jul 21 18:17:02 iPad-Sergej backboardd[29] <Warning>: Application 'UIKitApplication:com.MyApp[0xd3ac]' exited abnormally with signal 6: Abort trap: 6
Jul 21 18:17:02 iPad-Sergej SpringBoard[33] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
Jul 21 18:17:02 iPad-Sergej ReportCrash[161] <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/MyApp_2014-07-21-181701_iPad-Sergej.ips using uid: 0 gid: 0, synthetic_euid: 501 egid: 0

代码功能上传:

function uploadVideo(meeting_id) {  
    navigator.camera.getPicture(
        successGetFileFromCamera,
        failGetFileFromCamera,
        {
            quality: 50,
            destinationType: navigator.camera.DestinationType.FILE_URI,
            sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,
            mediaType: navigator.camera.MediaType.VIDEO
        }
    );

function successGetFileFromCamera(fileURI) {
    uploadFileToServ(fileURI);
}

function uploadFileToServ(fileURI) {
    window.resolveLocalFileSystemURL(fileURI, successGetFileFromLocal, failGetFileFromLocal);

    function successGetFileFromLocal(fileEntry) {
        fileEntry.file(successFile, failFile);
        function successFile(fileObj) {
            var localURL = fileObj.localURL,
                fileName = fileObj.name;

            var options = new FileUploadOptions();
            options.fileKey = "my_video";
            options.fileName = fileName;
            options.mimeType="video/mp4";
            var params = {};
            params.meeting_id = meeting_id;
            options.params = params;
            options.chunkedMode = true;

            var ft = new FileTransfer();
            ft.onprogress = function(progressEvent) {
                if(progressEvent.lengthComputable) {
                    updateProgress(Number(((progressEvent.loaded / progressEvent.total) * 100).toFixed(1)));
                }
            };
            showProgress();

            ft.upload(localURL, encodeURI(window.host + "/myserver/mobile/uploadFile/t:" + window.Token), successUploadFileToServ, failUploadFileToServ, options);
        }
}

}

1 个答案:

答案 0 :(得分:1)

我认为这是错误消息的关键部分:

  

无法分配内存

iPad 2只有512MB的RAM,因此您似乎正在努力推动硬件。