我尝试将Parse.push.send
与我定义的云功能一起用于向设备发送推送通知。我按照CodePath Guide上的指南进行操作,并在iOS应用程序中收到成功回复。但是,没有提供任何远程通知。我的_p_installationKey
集合中也有_User
,我可以验证_Installation
集合中是否还有与_User
集合中存储的地址匹配的条目。对于我调用的每个云函数,将插入一个_PushStatus
条目,但numSent为0.以下是存储在我的MLab和我的环境中的集合。
{
"_id": "3mxSHXoZa0",
"pushTime": "2017-05-19T17:38:46.346Z",
"query": "{\"deviceType\":\"ios\"}",
"payload": "{\"alert\":\"Message: Testing\"}",
"source": "rest",
"status": "running",
"numSent": 0,
"pushHash": "424b520d52c5e20b4eb95be535cb2d54",
"_wperm": [],
"_rperm": [],
"_acl": {},
"_created_at": {
"$date": "2017-05-19T17:38:46.346Z"
},
"_updated_at": {
"$date": "2017-05-19T17:38:46.408Z"
},
"count": 1
}
{
"_id": "EMZ8EUmrC6",
"timeZone": "America/Los_Angeles",
"deviceToken": "55097f4ceca541cc5b02b5852d96d10c8238f147c3ec53c3e8a44bfc66520e41",
"deviceType": "ios",
"appVersion": "1",
"appName": "myAppName",
"channels": [
"global"
],
"installationId": "ae540abe-21d4-446f-b90f-f5b6bec04109",
"appIdentifier": "myAppIdentifier",
"parseVersion": "1.14.2",
"localeIdentifier": "en-US",
"badge": 0,
"_created_at": {
"$date": "2017-05-19T06:03:14.614Z"
},
"_updated_at": {
"$date": "2017-05-19T06:03:14.614Z"
}
}
{
"_id": "ZEMtqdJMaw",
"_p_installationKey": "_Installation$EMZ8EUmrC6",
"username": "121259958664",
"_hashed_password": "$2a$10$HR6TtUFB5G3tkeA9LlHbvuKOE2rpG.gvyHqAjsOQBps.X9jQvu9DO",
"_wperm": [
"ZEMtqdJMaw"
],
"_rperm": [
"*",
"ZEMtqdJMaw"
],
"_acl": {
"ZEMtqdJMaw": {
"w": true,
"r": true
},
"*": {
"r": true
}
},
"_created_at": {
"$date": "2017-05-19T06:03:27.637Z"
},
"_updated_at": {
"$date": "2017-05-19T06:03:27.637Z"
}
}
// iOS push testing
Parse.Cloud.define("iosPushTest", function(request, response) {
// request has 2 parameters: params passed by the client and the authorized user
var params = request.params;
var user = request.user;
// Our "Message" class has a "text" key with the body of the message itself
var messageText = params.text;
var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.equalTo('deviceType', 'ios'); // targeting iOS devices only
Parse.Push.send({
where: pushQuery, // Set our Installation query
data: {
alert: "Message: " + messageText
}
}, { success: function() {
console.log("#### PUSH OK");
response.success('success');
}, error: function(error) {
console.log("#### PUSH ERROR" + error.message);
response.error('failed');
}, useMasterKey: true});
});
var devCertPath = path.resolve(__dirname, 'ParsePushDevelopmentCertificate.p12');
var pushConfig = {'ios': [
{
pfx: devCertPath, // P12 file only
bundleId: 'myBundleId', // change to match bundleId
production: false // dev certificate
}
]
};
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed
liveQuery: {
classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
},
push: pushConfig
});
at Object.onceWrapper (events.js:293:19)
2017-05-19T18:06:04.498577+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:06:04.498577+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:06:04.498578+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:06:04.498579+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9)
2017-05-19T18:06:04.498579+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:06:04.501023+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Socket Error
2017-05-19T18:06:04.501397+00:00 app[web.1]: Fri, 19 May 2017 18:06:04 GMT apn Socket closed undefined
2017-05-19T18:06:04.501480+00:00 app[web.1]: Fri, 19 May 2017 18:06:04 GMT apn Removing socket from pool undefined
2017-05-19T18:06:04.501686+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Disconnected
2017-05-19T18:06:04.501787+00:00 app[web.1]: Fri, 19 May 2017 18:06:04 GMT apn 1 left to send
2017-05-19T18:06:20.502222+00:00 app[web.1]: Fri, 19 May 2017 18:06:20 GMT apn Initialising connection
2017-05-19T18:06:20.502541+00:00 app[web.1]: Fri, 19 May 2017 18:06:20 GMT apn 1 left to send
2017-05-19T18:06:20.611635+00:00 app[web.1]: Fri, 19 May 2017 18:06:20 GMT apn Socket error occurred undefined { Error: socket hang up
2017-05-19T18:06:20.611637+00:00 app[web.1]: at TLSSocket.onHangUp (_tls_wrap.js:1120:19)
2017-05-19T18:06:20.611638+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:06:20.611639+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:06:20.611652+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:06:20.611653+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:06:20.611654+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:06:20.611655+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9) code: 'ECONNRESET' }
2017-05-19T18:06:20.611802+00:00 app[web.1]: Fri, 19 May 2017 18:06:20 GMT apn Destroying connection undefined
2017-05-19T18:06:20.611886+00:00 app[web.1]: Fri, 19 May 2017 18:06:20 GMT apn Removing socket from pool undefined
2017-05-19T18:06:20.612721+00:00 app[web.1]: Fri, 19 May 2017 18:06:20 GMT apn Raising error: { Error: socket hang up
2017-05-19T18:06:20.612723+00:00 app[web.1]: at TLSSocket.onHangUp (_tls_wrap.js:1120:19)
2017-05-19T18:06:20.612724+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:06:20.612724+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:06:20.612725+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:06:20.612725+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:06:20.612726+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:06:20.612727+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9) code: 'ECONNRESET' } undefined undefined
2017-05-19T18:06:20.612870+00:00 app[web.1]: Fri, 19 May 2017 18:06:20 GMT apn Error occurred with trace: Error: socket hang up
2017-05-19T18:06:20.612871+00:00 app[web.1]: at TLSSocket.onHangUp (_tls_wrap.js:1120:19)
2017-05-19T18:06:20.612872+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:06:20.612872+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:06:20.612873+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:06:20.612873+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:06:20.612874+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:06:20.612875+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9)
2017-05-19T18:06:20.613192+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Socket Error
2017-05-19T18:06:20.613647+00:00 app[web.1]: Fri, 19 May 2017 18:06:20 GMT apn Socket closed undefined
2017-05-19T18:06:20.613741+00:00 app[web.1]: Fri, 19 May 2017 18:06:20 GMT apn Removing socket from pool undefined
2017-05-19T18:06:20.624646+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Disconnected
2017-05-19T18:06:20.624800+00:00 app[web.1]: Fri, 19 May 2017 18:06:20 GMT apn 1 left to send
2017-05-19T18:06:52.614568+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn Initialising connection
2017-05-19T18:06:52.614810+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn 1 left to send
2017-05-19T18:06:52.758861+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn Socket error occurred undefined { Error: socket hang up
2017-05-19T18:06:52.758864+00:00 app[web.1]: at TLSSocket.onHangUp (_tls_wrap.js:1120:19)
2017-05-19T18:06:52.758865+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:06:52.758866+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:06:52.758866+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:06:52.758867+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:06:52.758868+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:06:52.758869+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9) code: 'ECONNRESET' }
2017-05-19T18:06:52.759154+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn Destroying connection undefined
2017-05-19T18:06:52.759277+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn Removing socket from pool undefined
2017-05-19T18:06:52.759717+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn Raising error: { Error: socket hang up
2017-05-19T18:06:52.759719+00:00 app[web.1]: at TLSSocket.onHangUp (_tls_wrap.js:1120:19)
2017-05-19T18:06:52.759720+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:06:52.759720+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:06:52.759721+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:06:52.759722+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:06:52.759722+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:06:52.759723+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9) code: 'ECONNRESET' } undefined undefined
2017-05-19T18:06:52.759875+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn Error occurred with trace: Error: socket hang up
2017-05-19T18:06:52.759876+00:00 app[web.1]: at TLSSocket.onHangUp (_tls_wrap.js:1120:19)
2017-05-19T18:06:52.759877+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:06:52.759878+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:06:52.759878+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:06:52.759879+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:06:52.759880+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:06:52.759880+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9)
2017-05-19T18:06:52.760240+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Socket Error
2017-05-19T18:06:52.760741+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn Socket closed undefined
2017-05-19T18:06:52.760851+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn Removing socket from pool undefined
2017-05-19T18:06:52.761152+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Disconnected
2017-05-19T18:06:52.761244+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn 1 left to send
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2017-05-19T18:06:52.759877+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:06:52.759878+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:06:52.759878+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:06:52.759879+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:06:52.759880+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:06:52.759880+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9)
2017-05-19T18:06:52.760240+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Socket Error
2017-05-19T18:06:52.760741+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn Socket closed undefined
2017-05-19T18:06:52.760851+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn Removing socket from pool undefined
2017-05-19T18:06:52.761152+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Disconnected
2017-05-19T18:06:52.761244+00:00 app[web.1]: Fri, 19 May 2017 18:06:52 GMT apn 1 left to send
2017-05-19T18:07:42.422486+00:00 heroku[router]: at=info method=POST path="/parse/push" host=spottune.herokuapp.com request_id=4ebb4912-b4d5-42bd-8057-21cb23763300 fwd="54.204.64.16" dyno=web.1 connect=0ms service=18ms status=200 bytes=533 protocol=https
2017-05-19T18:07:42.368169+00:00 app[web.1]: [36mverbose[39m: REQUEST for [POST] /parse/functions/iosPushTest: {
2017-05-19T18:07:42.368182+00:00 app[web.1]: "text": "Testing"
2017-05-19T18:07:42.368186+00:00 app[web.1]: } method=POST, url=/parse/functions/iosPushTest, host=myapp.herokuapp.com, connection=close, x-parse-app-display-version=1.0, x-parse-application-id=applicationID, accept=*/*, accept-language=en-us, x-parse-os-version=10.3.2 (14F5080a), user-agent=Spottunes/1 CFNetwork/811.5.3 Darwin/16.6.0, x-parse-app-build-version=1, content-type=application/json; charset=utf-8, x-parse-session-token=r:d574da7c3405de7c7cad42c147bcec85, x-parse-client-version=i1.14.2, x-parse-installation-id=ae540abe-21d4-446f-b90f-f5b6bec04109, accept-encoding=gzip, deflate, x-request-id=1d2c625e-2d55-4270-b9b0-9b3c74ea457d, x-forwarded-for=128.54.116.32, x-forwarded-proto=https, x-forwarded-port=443, via=1.1 vegur, connect-time=0, x-request-start=1495217262279, total-route-time=0, content-length=18, text=Testing
2017-05-19T18:07:42.409208+00:00 app[web.1]: [36mverbose[39m: REQUEST for [POST] /parse/push: {
2017-05-19T18:07:42.409211+00:00 app[web.1]: "where": {
2017-05-19T18:07:42.409212+00:00 app[web.1]: "deviceType": "ios"
2017-05-19T18:07:42.409213+00:00 app[web.1]: },
2017-05-19T18:07:42.409214+00:00 app[web.1]: "data": {
2017-05-19T18:07:42.409214+00:00 app[web.1]: "alert": "Message: Testing"
2017-05-19T18:07:42.409215+00:00 app[web.1]: }
2017-05-19T18:07:42.409218+00:00 app[web.1]: } method=POST, url=/parse/push, host=myapp.herokuapp.com, connection=close, user-agent=node-XMLHttpRequest, Parse/js1.9.2 (NodeJS 7.10.0), accept=*/*, content-type=text/plain, x-request-id=4ebb4912-b4d5-42bd-8057-21cb23763300, x-forwarded-for=54.204.64.16, x-forwarded-proto=https, x-forwarded-port=443, via=1.1 vegur, connect-time=0, x-request-start=1495217262403, total-route-time=0, content-length=237, deviceType=ios, alert=Message: Testing
2017-05-19T18:07:42.410004+00:00 app[web.1]: [33mwarn[39m: Trying to schedule a push while server is not configured.
2017-05-19T18:07:42.410267+00:00 app[web.1]: [33mwarn[39m: Push will be sent immediately
2017-05-19T18:07:42.420038+00:00 app[web.1]: [36mverbose[39m: RESPONSE from [POST] /parse/push: {
2017-05-19T18:07:42.420040+00:00 app[web.1]: "headers": {
2017-05-19T18:07:42.420041+00:00 app[web.1]: "X-Parse-Push-Status-Id": "OBtnkjGpL8"
2017-05-19T18:07:42.420042+00:00 app[web.1]: },
2017-05-19T18:07:42.420043+00:00 app[web.1]: "response": {
2017-05-19T18:07:42.420043+00:00 app[web.1]: "result": true
2017-05-19T18:07:42.420044+00:00 app[web.1]: }
2017-05-19T18:07:42.420044+00:00 app[web.1]: } X-Parse-Push-Status-Id=OBtnkjGpL8, result=true
2017-05-19T18:07:42.428718+00:00 app[web.1]: #### PUSH OK
2017-05-19T18:07:42.429322+00:00 app[web.1]: [32minfo[39m: Ran cloud function iosPushTest for user ZEMtqdJMaw with:
2017-05-19T18:07:42.429324+00:00 app[web.1]: Input: {"text":"Testing"}
2017-05-19T18:07:42.429325+00:00 app[web.1]: Result: "success" functionName=iosPushTest, text=Testing, user=ZEMtqdJMaw
2017-05-19T18:07:42.430053+00:00 app[web.1]: [36mverbose[39m: RESPONSE from [POST] /parse/functions/iosPushTest: {
2017-05-19T18:07:42.430054+00:00 app[web.1]: "response": {
2017-05-19T18:07:42.430055+00:00 app[web.1]: "result": "success"
2017-05-19T18:07:42.430056+00:00 app[web.1]: }
2017-05-19T18:07:42.430056+00:00 app[web.1]: } result=success
2017-05-19T18:07:42.433082+00:00 app[web.1]: [36mverbose[39m: _PushStatus OBtnkjGpL8: sending push to 1 installations
2017-05-19T18:07:42.458687+00:00 app[web.1]: Fri, 19 May 2017 18:07:42 GMT apn 2 left to send
2017-05-19T18:07:42.432839+00:00 heroku[router]: at=info method=POST path="/parse/functions/iosPushTest" host=spottune.herokuapp.com request_id=1d2c625e-2d55-4270-b9b0-9b3c74ea457d fwd="128.54.116.32" dyno=web.1 connect=0ms service=151ms status=200 bytes=502 protocol=https
2017-05-19T18:07:56.765036+00:00 app[web.1]: Fri, 19 May 2017 18:07:56 GMT apn Initialising connection
2017-05-19T18:07:56.767442+00:00 app[web.1]: Fri, 19 May 2017 18:07:56 GMT apn 2 left to send
2017-05-19T18:07:57.045303+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn Socket error occurred undefined { Error: socket hang up
2017-05-19T18:07:57.045317+00:00 app[web.1]: at TLSSocket.onHangUp (_tls_wrap.js:1120:19)
2017-05-19T18:07:57.045318+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:07:57.045318+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:07:57.045319+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:07:57.045319+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:07:57.045320+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:07:57.045320+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9) code: 'ECONNRESET' }
2017-05-19T18:07:57.045416+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn Destroying connection undefined
2017-05-19T18:07:57.045473+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn Removing socket from pool undefined
2017-05-19T18:07:57.045796+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn Raising error: { Error: socket hang up
2017-05-19T18:07:57.045797+00:00 app[web.1]: at TLSSocket.onHangUp (_tls_wrap.js:1120:19)
2017-05-19T18:07:57.045797+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:07:57.045798+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:07:57.045798+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:07:57.045799+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:07:57.045799+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:07:57.045800+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9) code: 'ECONNRESET' } undefined undefined
2017-05-19T18:07:57.045910+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn Error occurred with trace: Error: socket hang up
2017-05-19T18:07:57.045912+00:00 app[web.1]: at TLSSocket.onHangUp (_tls_wrap.js:1120:19)
2017-05-19T18:07:57.045912+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:07:57.045913+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:07:57.045914+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:07:57.045914+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:07:57.045915+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:07:57.045916+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9)
2017-05-19T18:07:57.046198+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Socket Error
2017-05-19T18:07:57.046589+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn Socket closed undefined
2017-05-19T18:07:57.046677+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn Removing socket from pool undefined
2017-05-19T18:07:57.046816+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Disconnected
2017-05-19T18:07:57.046889+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn 2 left to send
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2017-05-19T18:07:57.045912+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:07:57.045913+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:07:57.045914+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:07:57.045914+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:07:57.045915+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:07:57.045916+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9)
2017-05-19T18:07:57.046198+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Socket Error
2017-05-19T18:07:57.046589+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn Socket closed undefined
2017-05-19T18:07:57.046677+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn Removing socket from pool undefined
2017-05-19T18:07:57.046816+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Disconnected
2017-05-19T18:07:57.046889+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn 2 left to send
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2017-05-19T18:07:57.045912+00:00 app[web.1]: at Object.onceWrapper (events.js:293:19)
2017-05-19T18:07:57.045913+00:00 app[web.1]: at emitNone (events.js:91:20)
2017-05-19T18:07:57.045914+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-19T18:07:57.045914+00:00 app[web.1]: at endReadableNT (_stream_readable.js:975:12)
2017-05-19T18:07:57.045915+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-05-19T18:07:57.045916+00:00 app[web.1]: at process._tickDomainCallback (internal/process/next_tick.js:128:9)
2017-05-19T18:07:57.046198+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Socket Error
2017-05-19T18:07:57.046589+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn Socket closed undefined
2017-05-19T18:07:57.046677+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn Removing socket from pool undefined
2017-05-19T18:07:57.046816+00:00 app[web.1]: verb parse-server-push-adapter APNS APNS Connection 0 Disconnected
2017-05-19T18:07:57.046889+00:00 app[web.1]: Fri, 19 May 2017 18:07:57 GMT apn 2 left to send
print("sending push notification...")
let param: [String: Any] = [
"text" : "Testing"
]
PFCloud.callFunction(inBackground: "iosPushTest", withParameters: param) { (response, error) in
print("push \(response)")
}
sending push notification...
push Optional(success)
不确定我还应该添加什么才能使其发挥作用。任何帮助表示赞赏
答案 0 :(得分:0)
我没有在您的配置中看到您的APNS证书的文件路径。这需要包含在内,并且在index.js中需要进行一些额外的配置才能启用Push。在没有启用额外配置的情况下调用Push.send()时,不确定它是如何编程的,但这看起来正在进行中。所以,我的赌注是APNS无效。如果你在本地调试它,你可能会获得一些更有用的服务器输出。