Action sheet not working on simulator


#1

Hello,
I’m using release v4.0.6 with Cordova (v8.1.1), and action sheet (grid-type) does not work on the iOS simulator. (Everything worked when trying on the localhost). Am I missing something?

The buttons have ID (“ac-1”), and the action “ac1” is defined in “app.js”:

$$(’#ac-1’).on(‘click’, function () {
ac1.open();
});
var ac1 = app.actions.create({
grid: true,
buttons: [
[
{
text: ‘PREPARAR’,
label: true
},
{
text: ‘Tarjeta’,
} ]
});

In that .html file, these are the references to the .js files:

  <script src="framework7/js/framework7.bundle.min.js"></script>
  <script src="js/routes.js"></script>
  <script src="js/app.js"></script>

#2

Что значит “не работает”? Не срабатывает событие “click”?


#3

When on Chrome, the click action works; action sheet is shown and all the onClick actions from every single button on the action sheet works.

But on the simulator, no event is produced on click. Other components on the page work, though (eg. floating action button).


#4

Скорее всего там ошибка в чем-то другом, например, не загрузились файлы.

Делайте try … catch или гуглите как дебажить в Cordova. Еще попробуйте повесить событие прямо в коде Задача: локализовать место проблемы.


#5

И сначала напишите что-то типа alert(‘click’); чтобы понять, вызывается ли вообще действие или все же проблема в Action Sheet.


#6

Thank you; it made me start using Safari debugger. Seems like the line where the function is declared in app.js

var ac1 = app.actions.create({ …});

is never executed. There was a line above it that threw an error (in the simulator, but not in Chrome). So clicking on the button never invoked the function. Now that offending line is gone, it works. Thanks!