iOS静默推送通知仅在连接到xcode时有效 [英] iOS silent push notification only works when connected to xcode

查看:293
本文介绍了iOS静默推送通知仅在连接到xcode时有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题.

我最近将我的Xcode更新为6.1.1,以对以前使用Xcode 5发布的应用进行更改(效果很好).现在由于某种原因,当我测试后台无声推送通知时,使用新的Xcode只能在将iPhone连接到Mac时完全起作用吗?

I recently updated my Xcode to 6.1.1 to make a change to an app I previously released with Xcode 5 (working great). Now for some reason with the new Xcode when I test my background silent push notification it only completely works when I have my iPhone connected to my Mac?

应用程序执行的操作是当它获得静默推送时,该应用程序从服务器检索数据.我向无声推送添加了默认声音以进行测试,并且我确认该应用程序确实获得了推送,但是它没有连接到服务器以获取新数据.但是,如果我将闪电电缆插入Mac,一切正常,可以从服务器等获取数据.

What the app does is when it gets a silent push the app retrieves data from a server. I added the default sound to the silent push for testing, and I've confirmed that the app does get the push but it does not connect to the server to get the new data. But if I plug in the lightning cable to my mac everything works great, gets data from server etc.

我不确定该怎么办?任何想法或方向都将不胜感激.

I'm not sure what to do? Any ideas or direction is greatly appreciated.

谢谢!

推荐答案

即使我没有将静默推送发送到我的应用程序,我也没问题,但是即使该应用程序未连接到Xcode,您也必须注意,静默推送通知已被传递仅当您的应用在后台运行时.如果您通过双击iPhone主页按钮强制退出应用程序,则该通知将被忽略.

I got no problem to send silent push to my app, even if the app is not connected to Xcode BUT you have to notice that silent push notification is being delivered only if your app is running in the background. If you force quit your app using double tap on iPhone home button, the notification is ignored.

让用户完全杀死应用并停止任何传出/传入连接可能是一条Apple规则

It is probably an Apple rule to let user completely kill an app and stop any outgoing/incoming connection

这篇关于iOS静默推送通知仅在连接到xcode时有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆