簡體   English   中英

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

[英]phonegap notification in ios not working

Phonegap或Cordova通知無法在Backbone中運行,require和javascript。

因此,情況是,如果USERNAME或PASSWORD為空,則應通知(使用phonegap),但它將無法工作。 有任何想法嗎?

我有這個代碼

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("");
                    }
                },

解決了我的問題。 我使用了錯誤版本的cordova或phonegap。 我正在使用android版本,因為我也在Windows上對其進行了檢查。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM