How to lock iPhone app in portrait orientation? (SwiftUI) - ios

I'm trying to submit my app to the App Store, but I received a notification that it must run as expected and properly display on iPad, but that requires me to lock it to portrait mode, so the UI doesn't get messy.
The boxes of "Landscape Left and Landscape Right" are already unchecked and I already tried changing the Info.plist file.
Here's how the iPad version gets glitchy:

It looks like you are forcing an "iPhone Only" app to run on an iPad.
It might help to activate the iPad app version and then look at what needs to be changed.
Target > General > Deployment Info> Check iPad
If you truly have a SwiftUI app it should not need a lot of work.

Related

Display iPad screen as iPhone?

I have searched through the web and I did not get clues.
Is there a way to display iPad screen as an iPhone like this app does it?
The iPad displays an iPhone screen. Is there some configuration to display this behavior?
What you are seeing is the default behavior of running an iPhone-only app on an iPad. You don't have to do anything other than declare your iOS app as an iPhone-only app.
Of course it would be better for your users if your app properly worked on and took advantage of the iPad's screen but that's up to you.
If the supported devices, that appear under Project > Target > General Tab > Deployment Info
is selected to be "iPhone" and you run this version of app on an iPad, it will appear as the example you shared.

Xcode: specify orientations for both iPhones and iPads under Deployment Info?

Answers like this suggest it's possible to lock app orientation by checking boxes under the Deployment Info section of the General tab in Xcode.
However, doing so only worked for iPhones -- not iPads.
Specifically, we locked the app to only Portrait using the Deployment Info section but discovered people could still open the app in landscape on iPads.
Then we discovered another set of orientation keys in the app's plist file, which controls the app's orientation on iPads! Meaning the Deployment Info solution is misleading because it only works for iPhones.
So is it possible to graphically lock orientation for both iPhones and iPads from elsewhere in Xcode (similar to using the Deployment Info section), or is the only option to manually modify the plist file?
Screenshot of the Deployment Info section on Xcode 8.3:
Under the Deployment Info section there is an iPhone button and an iPad button. Click on iPad and you get a whole new set of options for Main Interface, Device Orientation, and Status Bar Style.
Of course this assumes the app is a Universal app and not an iPhone-only app.

Black bars on all sides when running iPhone app on iPad

I have an iPhone app and I am trying to run it on iPad. But when I run I see black bars on all the sides as shown below:
I am using a LaunchScreen.storyboard file. The LaunchScreen.storyboard is set as launch screen (checkmark is checked). In the target settings I have the following settings:
Any ideas?
Screenshot:
Edit: That apple tester got it wrong. your app is good !!!
I created a new project that only support an iphone and ran it on the ipad simulator. I calculated the ratio of the screen inside it is equal to 0.69. the same as the ratio of the screen inside the screen shot sent to you by apple.
Apple tester got it wrong. looks like that is the new behaviour on the
iOS 10 and that apple test does not know it. reply to them with this
they should accept your app without resubmitting new binary.
Original Answer:
Deleting DerivedData, Clean and remove app from simultator should solve the problem. Or maybe you didn't support iPad:
Its because of app is only for iphone, thats why if you are run in iPad it shows actually iphone's view, Enable for ipad and then check.
The Apple tester did not likely get it wrong. Check the following:
Go to your app's target. In the General tab, look at the Deployment section. What is listed for Devices? If it says Universal, change it to iPhone.
Go to your info.plist. Remove any keys pertaining to the iPad. (Supported interface orientations (iPad) may be there, for example.)
Now, your app should run correctly on an iPad, even though it was made for iPhone only.

Problems with device target for iOS app

)
Hello all :-)
I want to release an iPhone/iPod Touch only app. However, I know iPad users can still download the app from the app store, which is fine by me. I was simulating my app on simulator to see how it would look like on an iPad. When I simulated it, the app looked terrible: the layout was not the same as the iPhone version, some labels were colliding and buttons were "cut" out of the screen.
I want iPad users to have the same view as an iPhone. I believe a 1x/2x button would appear on the screen in that case. How can I do that?
Any help/advice would be really appreciated!
Thank you :-)
When you upload your app to the App Store it will also allow iPad users to download the iPhone version of the app. This will have the 1x/2x button you are looking for.
However if you test your project on the iPad simulator before you upload the app, it will not be the same iPhone version of the app that the iPad users will see. Instead the simulator will run an actual iPad version of the app which is not what your looking for.
In your project settings, set your target device to iPhone only. Upload the app. When iPad users download the app they will get the iPhone only version with the 1x/2x button for the iPad.
In your project settings, make sure the "Devices" settings is "Universal" (this is under "Deployment Info"). If it was not before, you may have to make some layout adjustments.
Use Autolayout for fixing the design issues
in storyboard right pane -> attribute inspector -> simulated metrics-> select inferred in size for all controllers
You should be seeing this in the simulator (note the letterboxing on all sides):
And your build settings should show 1 as the target device family:
If not, you are iPad-native and that's the source of the trouble.

Cordova 3.6.0: add only iphone support, no ipad at all

when i create a new cordova project using the cordova cli, it creates a clean project presetting the target device to iphone, but still adding ipad resources.
I can also install the app on iPad, even if i select iPhone on the Device select box.
I compared the cordova project with a new project i created in xCode6 selecting iPhone. I see differences, for example in cordova i can still see "Supported interfaces orientations (iPad)" and also the icons and splash screens for iPad. But in my new default xCode6 project, i can only see iphone related stuff.
How can i make cordova created ONLY for iPhone, no ipad files at all?
UPDATE: The reason is NOT to disable iPad support, i know it has to run fine on iPads compatible mode, but i have scaling issues, because the project seems to have iPads related resources and settings i dont see because its set to iPhone only. I had to switch to iPad and untick the unwanted orientations because on iPad it was allowing landscape even if i build for iPhone only. Very strange.
When you launch the app, just launch it for iPhone alone if you don't want to support iPads.
Go through this thread.
Here's the final accepted answer there:
The final answer is:
Once you added iPad support in App submission, there is no way to
remove it.
You have to block the access in iPad during App launch by checking
UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad
Other then that every iPhone app will always launch on iPad even without support but will open in an smaller window.

Resources