App targeted for both iPad and iPhone; removing iPad component pre-release - iphone

I'm about to release an app that I have been working on for quite some time and is has currently been built to target both iPhone and iPad. The app has both iPhone and iPad storyboards and various device specific code and views. I now wish to remove the iPad references and release the app targeted for iPhone only.
Can a project be changed in this way without too much difficulty and what are the potential complications that may arise?

You should be able to change the device target in Xcode to just iPhone, then verify the build runs in the iPhone simulator window on the iPad. You can also check the bundle plist to verify that UIDeviceTarget contains only 1, not 1 and 2.
If you want to remove the iPad resources, click on your storyboard (or other files), check the properties pane, and uncheck the target. This will stop the file from being copied into the app bundle.

In this image you can see Devices is selected for iPhone only. You can change it from here.

Related

Change app to only iPhone deployment

Im using Xcode 4.1 lion release. My app was rejected because it only works on the iPhone, this is how it should be, but i guess i didnt set my app up so it only works on the iPhone. How would i do so?
I go to Targeted Device Family under my project build settings and i have iPhone selected.
`
What else do i need to do. Thanks
EDIT: During the app review it was still set up under device family as iPhone
Remove and iPad xib files that were created initially. By default Xcode makes an iPad folder when you select the universal build, remove that and you should be good. Other considerations might be to remove iPad launch images if they are present, or any iPad specific code like popover view controllers etc.

Downgrading iPad app to iPhone app

We can upgrade an iPhone project to iPad project as mentioned in the link:
http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/120-Building_and_Running_Applications/building_and_running_applications.html
But, I am having an project that is created for iPad. Now, I want to create another target for iPhone (supporting OS same as iPad). How do I do this?
Thanks and Regards,
Deepa
You probably do not want to create a new target for iPhone. What you want is to have a single target that creates a universal application that runs on both iPad and iPhone/iPod touch.
First go to the project settings and change the setting for "Target Device Family" from "iPad" to "iPhone/iPad".
Secondly you will also need two MainMenu.nibs, one for iPad and one for iPhone. You do this in the Info.plist for your target. The key NSMainNibFile should name the nib for iPHone, add a key named NSMainNibFile~iPad to name the nib for iPad.
Now the app is ready to run on both devices, (until you try to use UIPopoverController or other iPad specific class on the phone). Rest of the work is just to make it pleasant, one view at the time.
Use the run-time check [UIDevice currentDevice].userInterfaceIdiom to check at run-time what kind of device you are running. To choose different nibs to load, and other user experience differences.

Universal apps are not working right. Why?

Which part of the app is it that "triggers" the iPad app as it's own app as opposed to running the iPhone version in a universal binary?
What do I need to change to make my app Universal, after clicking "Upgrade current Target for iPad"? My app runs on outside of the simulator, but my images are too small and my text is out of place. What am I missing here?
To the opposite end, how do I force my Universal app to run as an iPhone app inside the simulator on the iPad? (When changing "Target Device Family", it will run the iPad version of the app in the simulator, but not the iPhone version.)
EDIT:
It seems to me that these questions kind of complement each other. While I suspect it's the same mechanism at work in both situations, I'm not sure what it is, or how it works.
There are keys in the info.plist file put there by the Targeted Device Family setting. The iPad looks for those plist keys to determine whether to launch as a Universal app or in iPhone emulation mode, and which idiom's xib files to use for app launch.
Added:
If you don't have, and specify in the plist, a .xib file suitable for the iPad idiom, then one with the wrong UIWindow frame is used, which ends up in the upper left corner.
You need to re-code the app for the iPad to lay out your text and images how you want them when it is running on an iPad.
To make it run as an iPhone app you stop it being Universal.
The build setting is called Target Device Family
That's where it starts.
If you wrote a universal app and you want to force the iPhone mode on the iPad you switch Target Device Family to iPhone only and it will ignore everything else.

Convert ipad application to iphone. Universal app

Convert iPad application to iPhone- Universal app.
I already have one iPad application, now I want to make a universal app of that iPad application.
How to convert? Is it possible? Or do I have to start a new app?
Open up your project in Interface Builder. Click on the disclosure triangle next to "Targets", then right-click on the target and choose "Upgrade Current Target for iPad...".
Then read the iPad Programming Guide, especially the section Starting Your Project.
Edit:
I see now -- iPad to iPad/iPhone.
I think you would do something like the following:
Create a .xib for the iPhone for the
Main Window/App Delegate/etc, to
corresspond your existing .xib for
iPad.
Add an entry in your info plist:
NSMainNibFile, with the value of the
name of your new iPhone xib
Go to your build settings and set
the Base SDK to 4.1 (or 4.0 if you
still have the older SDK installed)
Keep your iOS Deployment Target
build setting at 3.2 if you're only
worried about iPhones and iPod
Touches with 4.x.
Set the Targeted Device Family build
setting to iPhone/iPad
Start refactoring your code to
create two different code paths, one
for iPhone and one for iPad, where
appropriate.

Downgrade iPhone/iPad app to iPhone-only XIB

I recently converted my iPhone app to be for iPad as well by right-clicking on the target and selecting "Upgrade Current Target for iPad". Then, every time I opened the app with the iPad simulator, it opens the newly created MainWindow-iPad.xib.
However, I ran into problems, so what I'd like to do is "downgrade" the iPhone app so it only runs the iPhone xib on the iPhone/iPad. (So when it runs on the iPhone, it runs normally, and on the iPad it opens in the "smaller" view for iPhone-only apps). Is this possible, or do I have to change the build targets or something along those lines?
Thanks for any help in advance.
It is fairly easy to undo the changes made by Xcode. Look at the Info.plist file for your app and you should see an entry named NSMainNibFile~ipad. This is what causes the iPad specific NIB file to be loaded. If you delete that entry you should be back to using the iPhone NIB file for both devices.
You may also want to change the Targeted Device Family from iPhone/iPad back to be just iPhone.