Hi, I’m coding an app that works fine in my browser emulator, but crashes when I try to do a specific function in Ionic View. My device is an iPhone 4. I am aware that the finished app has to be developed on iOS to have it run on iPhones, but I was under the impression that it didn’t matter if it was in Ionic View (plus, everything else in my app works).
When I tap the Photo Upload button, I’m asked if I want to either “Take Photo or Video”, “Choose Existing”, or “Cancel” in a drop down menu. If I choose anything but Cancel, I am immediately taken back to the “My Apps” section of Ionic View. Any attempt to view the App again without first completely restarting Ionic View is met with an eternal loading time.
The code for this function is here.
.controller(‘uploadCtrl’, [’$scope’, ‘Upload’, function ($scope, Upload, dataService, Camera)
{
$scope.$watch(‘files’, function(){
$scope.upload($scope.files);
});
$scope.upload = function (files)
{
console.log(“Function Called”);
//console.log(sharedProperties.); if(files && files.length){ for (var i = 0; i <files.length; i++) { var file = files[i]; console.log("Function looping"); Upload.upload ({ url: '/', method: 'POST', fields: {key: "catpicture", AWSAccessKeyId: 'Not Showing', acl: 'private', policy: '', signature: '=', "Content-Type": file.type != '' ? file.type : 'application/octet-stream', success_action_redirect: "google.com", filename: "catpicture"}, file: file }).progress(function(evt){ var progressPercentage = parseInt(100.0 * evt.loaded / evt.total); console.log('progress: ' + progressPercentage + '% ' + evt.config.file.name);}).success(function(data,status,headers,config){ console.log('file ' + config.file.name + ' uploaded. Response: ' + data); }); } } }; }]);
And the accompanying html code is here.
> button ngf-select=“upload($files)” class=“button button-block button-stable”>
Photo Upload /button>
(I have valid signatures and all for the upload parameters, I just removed them so I wouldn’t be posting them online publicly.Also, not sure on how to format HTML on here without it disappearing, but I removed the < from the first and last lines of the HTML that I posted.