Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing a closed ios app

I'm currently trying to handle different application states (closed, background or in a different tab of the app) however when I try to test how the app works when it is closed and receives a push notification(double click home and force close the app then reopen it) I'm not sure where I'm going wrong in the code. Since I'm reopening the app from the phone itself and not xcode I can't test to see which method isn't being reached because no output is available in the console. Is there any way to test a situation like this or simulate a force close event in xcode so that when i re run the app on the phone it also launches in xcode?

I appreciate any responses.
Cheers!

like image 896
Tyler Pierog Avatar asked Jun 06 '16 13:06

Tyler Pierog


3 Answers

If you force close app or stop (from xcode) then it close the connection with xcode. Then if you open it from phone then it will not make connection with xcode. You must run it from xcode. And there is no difference in opening app from phone or running from xcode. App's flow will be same in both case. So what you want to test that which methods get calls and in which sequence that you can check by rerunning the project.

Update:

  • Select the Scheme on the toolbar (just left beside from your device or simulator list)

  • Choose Edit Scheme

  • Select Run in the left panel

  • For the Launch option, select Wait for executable to be launched

enter image description here

Refer this link for more details

like image 156
Ketan Parmar Avatar answered Oct 19 '22 10:10

Ketan Parmar


Since I'm reopening the app from the phone itself and not xcode I can't test to see which method isn't being reached because no output is available in the console.

In Xcode, hold down the Option key and choose Product->Run..., and then edit the Run scheme to use the "Wait for executable to be launched" option. You should then be able to choose Run in Xcode, and then open your app by some other means, such as responding to a notification, and Xcode will still connect and let you debug.

like image 44
Caleb Avatar answered Oct 19 '22 11:10

Caleb


To debug the process after restarting the app again, attach the Xcode debug console to the running process.

In Xcode do:

Debug > Attach to process > [select your process]

like image 35
Hodson Avatar answered Oct 19 '22 11:10

Hodson