I'm seeing odd behavior from [UIScreen screens]
in iOS 5.0.1 in reports we log to Flurry on crashes. There are times when [UIScreen screens]
will return an empty array. Our app implements support for external accessories through the EAAccessory framework. This behavior is totally unexpected, since even Apple's documentation says that the array returned from that method will always contain at least one entry.
Asked
Active
Viewed 325 times
6

David Potter
- 2,272
- 2
- 22
- 35
-
3I'm pulling this out of thin air, but could it perhaps be when your app is backgrounded and has no screen to render to? – Aidan Steele May 30 '12 at 01:46
-
1Worse than silent, at least [one doc](http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingWindows/CreatingWindows.html#//apple_ref/doc/uid/TP40009503-CH4-SW12) says "The array returned by this method always contains at least one object representing the main screen." – John Flatness May 30 '12 at 02:05
-
Thanks for finding that, John. Sedate, not a bad suggestion. I'll run with that and see if I can find a repro with that. Thanks both of you. – David Potter May 30 '12 at 20:00
-
Could you let us know when you find what was causing this? – JP Illanes Jun 04 '12 at 20:24
-
As I looked into this more, I realized that when the app is in the background it gets disconnected from the external accessory first, so it's highly unlikely that this could be it. Further testing did not produce a repro of this particular case, so it's frustrating that this is happening for some of our users. – David Potter Jul 03 '12 at 01:22
1 Answers
0
You're not attached to a window server at that point, because of your crash - your app is basically not running.

quellish
- 21,123
- 4
- 76
- 83
-
I suppose that's possible, but the call is being made while connecting an accessory, so I don't see how that could happen. Thanks for the suggestion though. – David Potter Jul 03 '12 at 01:23