【发布时间】:2014-11-03 00:12:37
【问题描述】:
我发出这样的 Parse REST API 请求
curl -X POST \
-H "X-Parse-Application-Id: key-here" \
-H "X-Parse-REST-API-Key: key-here" \
-H "Content-Type: application/json" \
-d '{
"where": {
"deviceToken": "token-here",
"deviceType": "ios"
},
"data": {
"aps": {"content-available": "1"}
}
}' \
https://api.parse.com/1/push
现在,当应用打开时,设备会读取它。但是当我锁定设备并再次发出上述 curl 请求时,没有任何反应。下面是我的didReceiveRemoteNotification 函数。
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
println("received notification")
var remoteServer = RemoteServer()
remoteServer.sendDataToServer { (success) -> () in
completionHandler(UIBackgroundFetchResult.NewData)
}
}
只要我打开应用程序,didReceiveRemoteNotification 的内部调用就会被执行。但同样,当应用程序未打开或手机被锁定时,什么也不会发生。
这里有什么想法/建议吗?
【问题讨论】:
标签: ios swift parse-platform push-notification