Add iPad target to existing iPhone project or make universal = no touches

I am seeing something really odd. Initially I wanted to add another target to my iPhone app project, for iPad. So I duplicated the target, changed the device family to iPad, then built and ran in the simulator. The app looks good and the existing XIB seemed to adapt and look good on the iPad. However, no touches were being recognized anywhere on the screen.


So then I tried simply making the existing target universal, and same deal, looks good on the iPad simulator but no touches recognized.


Thinking this may be due to an oddity in this particular project, I tried these steps on a different project and same result, looks OK but no touches recognized in the simulator.


These are older projects with a XIB and not a storyboard. While they look OK on the iPad, clearly something is not being properly tweaked for iPad if no touches are recognized.


Anybody have any ideas? I am wondering if there are some obscure settings in the project or XIB that I need to fix, which newer Xcodes (tried 10 and 11) might be missing. It's been ages since I converted an iPhone app to universal.


Unfortunately my daughter has my actual iPad and I can't test on actual hardware right now, but I have no reason to believe this is limited to the simulator. Seems more like a project/target/Xcode thing.


thanks,

219

Replies

I would check the view debugger to see if there is a superview with zero size somewhere due to a layout problem (e.g. incorrect or missing constraints). By default views do not clip to bounds, but their subviews won't receive touches outside the bounds.

I'd be surprised if the layout was that easy to repurpose, but you should get hits somewhere, I think.


I'd start by deleting and redoing the file's owner connections, then perform a clean build folder, then see if that makes a difference in touch zones.


I'd also wonder if it would be better to create a new uni project and add the older assets to it instead of attempting to modernize, but that's just me 😉

So the view debugger showed one view with an unexplained 2400pt height. Once I corrected that, all was well.


Oddly, the other project that had the same problem also had a 2400pt high view. Projects are totally unrelated, other than both being older with XIBs. I can only assume this was some goofup in Xcode when adding the iPad target.

Well, that was a red herring. The problem reappeared when testing the app on different iPad models in the simulator. The only one that works is the iPad Pro 9.7; on all the others, no touches are recognized. I am starting to think this is some oddness with the simulator.

I don't think it has anything to do w/the simulator. Converting has never been as simple as toggling the device family.