推送通知启动时调试应用程序 [英] Debugging App When Launched by Push Notification

查看:79
本文介绍了推送通知启动时调试应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一款接收推送通知的应用。我通过PHP页面100%全部工作。我的应用可以接收几种不同类型的推送通知。 PHP处理这个并向我的应用程序发送不同的信息包,这些信息都被收到了。

I am currently developing an app that receives Push Notifications. I have this all working 100% through a PHP page. There are several different types of push notifications my app can receive. The PHP handles this and sends different packets of information to my app which are all received just fine.

但是,当用户查看通知并启动我的应用时,我显然想采取与用户手动启动应用时不同的操作 - 最重要的是,取决于推送通知类型的不同操作。我的工作正常......在结构上。

However, when the users "views" the notification and my app launches, I obviously want to take a different action than I would if the user just launched the app manually - and on top of that, different actions depending on the push notification type. I have got this working fine... structurally.

我的一个推送类型应该打开一个UIView,它可以连接几个不同的服务器并协商数据和向前。例如,当从主菜单触发时,此UIView工作正常 - 但是当我的推送通知触发此UIView出现时,套接字连接未按预期运行。

One of my push types is supposed to open a UIView that makes several connections to several different servers and negotiates data back and forth. This UIView works fine when, for example, triggered from the main menu - however when my push notification is triggering this UIView to appear, the socket connections are not acting as expected.

现在我的问题不是关于套接字,而是更多 - 如何调试这样的问题?从我可以告诉我(我相对较新)当应用程序从推送通知启动时,没有办法将该执行链接到调试器/控制台/等...我正在尝试使用调试代码时非常困难UIAlertViews,因为在各种服务器之间来回通信很多。

Now my question is not about the sockets, but more so - How do you debug such a problem?? From what I can tell (I am relatively new) when the app launched from a push notification there is no way to link that execution to the debugger / console / etc... I am having a very difficult time trying to debug the code using UIAlertViews, as there are many lines of communication back and forth between the various servers.

您对我的建议将不胜感激。

Any advice you have for me would be greatly appreciated.

推荐答案

在XCode< 4.0(对于XCode> = 4,请参阅下面的delirus答案),您现在可以配置Xcode以在启动后将调试器附加到应用程序,而不是通过调试器启动应用程序。这使您可以调试根据应用程序的启动状态而变化的内容,例如URL方案,粘贴板和推送通知。

In XCode < 4.0 (for XCode >= 4, see answer by delirus below), you can now configure Xcode to attach the debugger to the app after you launch it, instead of launching the app through the debugger. This lets you debug things that vary based on the launch state of your application, such as URL schemes, pasteboards, and push notifications.


  1. In Xcode在Source栏中查找,在Targets下面会有Executables。

  2. 在可执行文件中打开应用程序的检查器。

  3. 单击检查器中的调试选项卡选项卡。

  4. 取消选中启动调试器后启动可执行文件

  5. 选中等待下次启动/推送通知

  1. In Xcode look in the Source bar, and below Targets there will be Executables.
  2. Bring up the inspector for your app in executables.
  3. Click on the Debugging tab tab in the inspector.
  4. Uncheck "Start executable after starting debugger"
  5. Check the "Wait for next launch/push notification"

现在当您从Xcode单击调试而不是启动应用程序时,将显示一个窗口,告诉它正在等待应用程序启动。然后,您通常在手机上启动应用程序,Xcode附加到它

Now when you click debug from Xcode instead of launching the app a window will display telling it is waiting for the app to launch. You then launch the app normally on the phone and Xcode attaches to it

这篇关于推送通知启动时调试应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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