我最近收到一张支持票,我们的一些网络应用程序的功能正在iPad上崩溃。在最新的iOS 7.0.6更新之前,此功能没有任何问题。我们有一些GWT ValueListBox,可以在更改值时更改DOM。在进行更改之前,我们向用户显示一条Window.confirm()消息,告知他们更改将产生的影响,并询问他们是否仍想继续。自更新以来,确认选择无效,Safari崩溃。这只发生在iPad上。该功能在桌面浏览器(IE,Chrome,Firefox,Safari和Chrome移动模拟器)上运行良好,但在iPad上崩溃了。还有其他人有这个问题吗?
以下是崩溃的屏幕截图:
以下是代码示例:
this._view.isPrimaryFoodGen().addValueChangeHandler(new ValueChangeHandler<Boolean>()
{
@Override
public void onValueChange(final ValueChangeEvent<Boolean> event)
{
@SuppressWarnings("unchecked")
ValueListBoxWithOldValue<Boolean> vlb = (ValueListBoxWithOldValue<Boolean>)event.getSource();
if (confirmQuestionChange() ){
changeGroupAndQuestions(CONSTANTS.PRIMARY_FOOD, event.getValue());
}
else {
vlb.setValue(vlb.getOldValue());
}
}
});
public boolean confirmQuestionChange()
{
if (!this._view.isImageCriteriaQuestionsVisible())
{ //questions aren't currently visible
return true;
}
boolean confirmed = Window.confirm("Changing this response will delete image data already collected. Do you wish to proceed?");
return confirmed;
}
对于防止iPad崩溃的解决方案的任何帮助将不胜感激。我在调用Window.confirm()之前尝试过关注另一个元素,希望删除overlay和ValueListBox选项以阻止任何JS冲突,但它没有用。
在下次更新修复此问题之前,我是否受苹果公司的支配? 或者有可行的解决方案吗?
答案 0 :(得分:0)
好的,所以事实证明,由于我找不到继续使用Window.confirm()的修复,我不得不通过更改onValueChange()和confirmQuestionChange()方法来使用手动创建的DialogBox来实现解决方案而不是Window.confirm()。它不是最佳解决方案,但Safari不再在iPad上崩溃,用户可以完成工作。以下是代码更改:
this._view.isPrimaryFoodGen().addValueChangeHandler(new ValueChangeHandler<Boolean>()
{
@Override
public void onValueChange(final ValueChangeEvent<Boolean> event)
{
confirmQuestionChange(CONSTANTS.PRIMARY_FOOD, event);
}
});
public void confirmQuestionChange(final String question, ValueChangeEvent<Boolean> event)
{
final ValueListBoxWithOldValue<Boolean> vlb = (ValueListBoxWithOldValue<Boolean>)event.getSource();
if (!this._view.isImageCriteriaQuestionsVisible()) //questions aren't currently visible, can change them no problem
{
changeGroupAndQuestions(question, vlb.getValue());
}
else{
//the following fix was put in place for issues with Safari on the iPad OPS-76
final DialogBox dialogBox = new DialogBox();
dialogBox.setHTML("<center>Changing this response will delete<br />image data already collected.<br />Do you wish to proceed?</center>");
dialogBox.setAnimationEnabled(true);
Button yesButton = new Button("YES");
Button noButton = new Button("NO");
HorizontalPanel dialogHPanel = new HorizontalPanel();
dialogHPanel.setWidth("100%");
dialogHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
dialogHPanel.add(noButton);
dialogHPanel.add(yesButton);
noButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
vlb.setValue(vlb.getOldValue());
dialogBox.hide();
}
});
yesButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
changeGroupAndQuestions(question, vlb.getValue());
dialogBox.hide();
}
});
// Set the contents of the Widget
dialogBox.setWidget(dialogHPanel);
dialogBox.setPopupPosition(180, 425);
dialogBox.show();
}
}
这是一个截图:
如您所见,ValueListBox选项在DialogBox出现之前关闭,并且屏幕不再锁定。