简体   繁体   English

iOS中的phonegap通知无法正常工作

[英]phonegap notification in ios not working

Phonegap or Cordova notification not working in Backbone, require and javascript. Phonegap或Cordova通知无法在Backbone中运行,require和javascript。

So the situation is if the USERNAME or PASSWORD is empty it should notify( using phonegap ) but it wont work. 因此,情况是,如果USERNAME或PASSWORD为空,则应通知(使用phonegap),但它将无法工作。 Any ideas? 有任何想法吗?

I have this code 我有这个代码

define([
'jquery',
'backbone',
'underscore',
'base64',
'mobile',
'cordova',
'const',
'text!template/login/login.tpl.html'
],function($, Backbone, _, base64, Mobile, Cordova, Const, template){

if(!Const.USERNAME || !Const.PASSWORD)
        {
            navigator.notification.alert("Invalid Username/Password!");
            $("input").val("");
        }else{

            var auth = EncodeAuth(Const.USERNAME,Const.PASSWORD);

            var sendAuthorization = function (xhr) {
              xhr.setRequestHeader('Authorization', auth)
            };

            this.model.save(this.model, {
                beforeSend : sendAuthorization,
                success: function(model,result){
                    if(result.ErrorMessage === null)
                    {
                        alert(JSON.stringify(result.Message));
                        $("input").val("");
                    }
                    else
                    {
                        alert(JSON.stringify(result.ErrorMessage));
                        $("input").val("");
                    }
                },

Solved my problem. 解决了我的问题。 I used the wrong version of cordova or phonegap. 我使用了错误版本的cordova或phonegap。 I'm using the android version since i'm also checking it on windows. 我正在使用android版本,因为我也在Windows上对其进行了检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM