I want to see what happens to my application if it is interrupted by a phone call or text message. Is there a way I can test this on the iPhone simulator?
-
post notification manualy – SPatel Feb 12 '20 at 10:46
3 Answers
It may not help in your situation (since it doesn't work in the simulator), but activating Siri works in a similar way to a phone call, sending your application to the background and interrupting audio, so is easier to test than making a call. Siri is on iPhone 4S and above, iPod touch 5th gen, and iPad 3 and above. Just hold down the home button if you have Siri enabled.

- 1,711
- 14
- 19
-
6This works. Siri triggers AppWillResignActive/AppDidBecomeActive, which is what you need to check for. – damian Apr 24 '14 at 10:33
-
This doesn't work on iOS 14. Even recording audio with `AVAudioRecorder`, it records the mic including the Siri interaction. – atxe Mar 17 '21 at 15:38
-
Doesn't work with `didEnterBackgroundNotification` but does with `willResignActiveNotification` as of iOS 16. – Skoua Dec 30 '22 at 15:31
To expand on Lewis Gordon's answer it also works for devices without Siri. If you have voice control enabled then holding the home button down will interrupt audio and resign active.

- 76
- 5
Hardware -> Toggle In-Call Status will let you test the in-call UI.
I don't know of a way to test interruptions in the simulator, but as Lewis Gordon points out, you can bring up Siri on a device — even if there's no phone.

- 3,455
- 23
- 26
-
12
-
2Sending to background is different from resigning active state. But interruotions don't send to background, they send your app into inactive state. So the question was how it's possible to test *that*. – Florian Pilz May 03 '12 at 10:40
-
-
4That's incorrect! This only simulates the bolder status bar, but does not create any interruption! – miho Oct 07 '12 at 17:17
-
1
-
Phone calls trigger only AppWillResignActive and AppDidBecomeActive. Home button triggers AppWillResignActive then AppDidEnterBackground, on resume AppWillEnterForeground then AppDidBecomeActive. So home button isn't exactly the same. – damian Apr 24 '14 at 10:34
-
Lewis Gordon's answer is checked green, with a score of 51 (as of this post). This post by Vincent is additive only, and the information is helpful — why is it voted down?? (It adds that *if* the reason why you want a phone call is for the UI aspect, then you can simulate that with ⌘Y to toggle the "In-call Status Bar") – AmitaiB Nov 15 '22 at 21:54