小编Big*_*keL的帖子

调用默认Phonegap后退按钮处理程序

我有一个phonegap应用程序,需要我捕获后退按钮.这可以游泳,但是当我在主屏幕并按下后退按钮时,我想调用原始事件处理程序,让应用程序关闭或者使用这样的按钮对平台做任何自然的事情.我知道我可以告诉应用程序退出,但要理解这是iPhone应用程序的不良形式.

无论我尝试什么(我尝试过很多东西),我都无法解决原始处理程序问题.有什么建议?

在我的代码中,我在我的backbutton事件处理程序中有一个switch语句,它根据需要将应用程序指向以下效果:

switch blahBlah
{
    case 'this' :
        doThis() ;
        break;
    case 'main' :
        // What do I do here that is well behaved for all platforms??? 
        break;
    default:
        doFoo() ;
} 
Run Code Online (Sandbox Code Playgroud)

javascript iphone android cordova

6
推荐指数
1
解决办法
7171
查看次数

无法再为某些用户从 Google Sheets 电子表格生成 PDF

近一年来,我们一直在使用以下代码将 Google 表格工作表(保存在 中theSheetName)导出为 .pdf 中指定的 PDF InboundID

上周,一次一个不同的用户无法再生成 PDF。我在包含“var newFile = DriveApp.createFile(blob);”的行中失败 错误是:

“从 text/html 到 application/pdf 的转换失败。”

果然,UrlFetchApp.fetch返回的是 HTML 而不是 PDF。同样,仅适用于某些用户。有没有人对为什么我的用户可能会看到这个有任何想法?

function sendPDFToDrive(theSheetName, InboundID) 
{
  var theSpreadSheet = SpreadsheetApp.getActiveSpreadsheet();
  var theSpreadsheetId = theSpreadSheet.getId();
  var thisSheetId = theSpreadSheet.getSheetByName(theSheetName).getSheetId();  
  var url_base = theSpreadSheet.getUrl().replace(/edit$/,'');
  var theOutFileName = "GASFILE_M_" + (Math.floor(Math.random() * 8997) + 1000) + '.pdf'
  //export as pdf
  var url_ext = 'export?exportFormat=pdf&format=pdf'   
      + (thisSheetId ? ('&gid=' + thisSheetId) : ('&id=' + theSpreadsheetId)) 
      // following parameters …
Run Code Online (Sandbox Code Playgroud)

pdf export google-sheets google-apps-script google-drive-api

3
推荐指数
2
解决办法
932
查看次数