2016-11-25 13 views
1

iOSアプリケーションをParse.comからHerokuのParse-Serverに移動しました。ここで私はmain.jsクラウドコードファイル内に持っているものです:私は主に私はすべての通知が(iOSアプリに)来て見ていないという事実を除いて動作しますPush-Notifications/Heroku-mLab

Parse.Cloud.beforeSave 
("Shop", function(request, response) 
{ 
var queryConfig,historicOrderVal; 

var queryConfig = new Parse.Query("Configuration"); 
queryConfig.find({ 
        success: function(resultConf) { 
        ....... 
        newShopAnnounce(); 
        response.success(); 
        }, 
        error: function() { 
        var reptMsg="The Configuration-UPDATE procedure failed for some reason."; 
        console.log(reptMsg); 
        response.error(reptMsg); 
        } 
        }); 
    }); 


function newShopAnnounce() 
{ 
    var reptMsg="Now inside newShopAnnounce."; 
    console.log(reptMsg); 
    var pushQuery = new Parse.Query(Parse.Installation); 
    pushQuery.equalTo('deviceType', 'ios'); 

    Parse.Push.send({ 
        where: pushQuery, // Set our Installation query 
        data: {alert: "NEWSHOP"} 
        }, { 
        success: function() {}, 
        error: function(error) { 
        throw "Got an error " + error.code + " : " + error.message; 
        } 
        }); 
} 

。 ログにnewShopAnnounce()関数が呼び出されているのがわかりますが、何も送信していないようです。

app[web.1]: Now inside newShopAnnounce. 
app[web.1]: info: beforeSave triggered for Shop for user Xacb6CzuH9: 
app[web.1]: Input: {....} 
app[web.1]: Result: {"object":{....}} className=Shop, triggerType=beforeSave, user=Xacb6CzuH9 
app[web.1]: error: Error generating response. ParseError { code: 115, message: 'Missing push configuration' } code=115, message=Missing push configuration 
app[web.1]: [object Object] 
heroku[router]: at=info method=POST path="/parse/classes/Configuration/XYZABC" host=myapp.herokuapp.com request_id=27558d44-d2f5-4a8a-bfef-b85ea4bff9fa fwd="54.158.219.143" dyno=web.1 connect=0ms service=161ms status=200 bytes=522 
2016-11-25T06:43:38.483058+00:00 heroku[router]: at=info method=POST path="/parse/logout" host=myapp.herokuapp.com request_id=123456-7718-4cf9-f54f-123456 fwd="106.130.42.63" dyno=web.1 connect=1ms service=173ms status=200 bytes=483 

私は何をしないのです:

Parse.Push.send({ 
       where: pushQuery, // Set our Installation query 
       data: {alert: "NEWSHOP"} 
       }, { 
       success: function() {}, 
       error: function(error) { 
       throw "Got an error " + error.code + " : " + error.message; 
       }, 
       useMasterKey: true 
       }); 

が、私はこの取得:私はParse.Push.sendを変更した場合に

()を呼び出しますか?

答えて

0

あなたの送付方法にはuseMasterKey: trueがありません。

あなたがプッシュ設定が欠落しているようで、あなたの参照 https://github.com/ParsePlatform/parse-server/issues/401

については、以下を参照してください。例えば、コンフィギュレーションに

push: { 
android: { 
    senderId: '', // The Sender ID of GCM 
    apiKey: '' // The Server API Key of GCM 
}, 
ios: { 
    pfx: '', // The filename of private key and certificate in PFX or PKCS12 format from disk 
    passphrase: '', // optional password to your p12 
    cert: '', // If not using the .p12 format, the path to the certificate PEM to load from disk 
    key: '', // If not using the .p12 format, the path to the private key PEM to load from disk 
    bundleId: '', // The bundle identifier associate with your app 
    production: false // Specifies which environment to connect to: Production (if true) or Sandbox 
} 

}

を以下を追加してください:

push: { 
    ios: [ 
     { 
      pfx: 'file/***_APNs_Distribution_Certificate.p12', // Dev PFX or P12 
      bundleId: 'com.***.***', 
      production: true // Dev 
     }, 
     { 
      pfx: 'file/***_APNs_Development_Certificate.p12', // Dev PFX or P12 
      bundleId: 'com.***.***'', 
      production: false // Dev 
     } 
    ] 
}, 

はまた、より多くのためにhttps://github.com/ParsePlatform/parse-server/wiki/Pushを参照してください。

+0

あなたは正しいと思われますが、おそらくもっと不足しています。あなたの提案を試した後、私は自分の投稿を更新しました。あなたはもっと言うかもしれません。 – Michel

+0

OK、ありがとう。 .p12ファイルを更新する必要があると思いますか? – Michel

+0

@Michel、有効期限が切れている場合その後、あなたのherokuサーバーにそれを組み込み、パスをプッシュ設定に追加します。 – Zero