iOS - Debugging an uncooperative UIAlertController


Alex Zavatone
 

On certain iDevices, we have a UIAlertController that refuses to display the text of the only button, the OK button. This has been a problem for the past year and of course it only appears in the alert used for the user to complete registration.

Oddly enough, in the UIAlertAction the text is not nil, the button area is tappable, we are adding it to the alertController in thread 1 and on some devices, it just doesn’t appear.

Does anyone have any tips for debugging this type of situation? I have a reproducible case on one device now (iOS 9.3.5, iPad 2) and am about to start looking in to the view hierarchy to see what I can see.

Has anyone else seen this type of situation before?

Thanks in advance,
Alex Zavatone


Alex Zavatone
 

Getting a little closer on this one.  

Apparently the UILabels within the UIActionViews have the appropriate text, but the UILabel and the UILabel’s tint colors are 0 or close to it and the font isn’t accessible.  Is there some known case where a UILabel’s view is not completed being created for a UIAlertAction?

This is working fine in the simulator and failing on the device 100% of the time.  

WELL!

It turns out that our UIAlertController category was grabbing the tint value from [UIApplicationController sharedApplication].delegate.window.tintColor;

This would return a close to zero tintColor only on some devices. Why?  Who knows.  Simply commenting out that line let the expected tintColor be displayed.  

Why the View Debugger showed a no font assigned to the label seemed odd, but as soon as I commented out that line, this worked. I’ll check to make sure that the tintColor isn’t close to white or transparent.

Apparently, assumption is the mother of all something something.

Cheers,
Alex Zavatone

On Jul 17, 2017, at 12:03 PM, Alex Zavatone <zav@...> wrote:

On certain iDevices, we have a UIAlertController that refuses to display the text of the only button, the OK button.  This has been a problem for the past year and of course it only appears in the alert used for the user to complete registration.

Oddly enough, in the UIAlertAction the text is not nil, the button area is tappable, we are adding it to the alertController in thread 1 and on some devices, it just doesn’t appear.

Does anyone have any tips for debugging this type of situation?  I have a reproducible case on one device now (iOS 9.3.5, iPad 2) and am about to start looking in to the view hierarchy to see what I can see.

Has anyone else seen this type of situation before?

Thanks in advance,
Alex Zavatone