Problems with Universal iPhone/ipad app build - iphone

I have created a Universal (iPhone/ipad) application .I have created separate Xib designs for iPhone and iPad both works well. When i build the app it should give a single .APP(build).I installed in iPhone and iPad tested correctly.
Now i want to give a two separate builds (for user to test), one for iPhone and another one for iPad.So in project settings i changed a target device family (iPhone/ipad -> into iPhone) and (iPhone/ipad -> into iPad). So it gives two separate builds.One for iPhone and another one for iPad.
My problem is when i build with iPhone(as target device family) and installed in iPad means it loads a iPad design not an iPhone design.What could be the mistake i did here ? I search a lot and could not find any solution.
If any one did like this? or do it for me?(testing)
Thanks in advance.....

It's because (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) if you run iPhone-designed app on iPad. And thats why iPad version of xib file is selected. So you need to attach correct .xib file manually, or exclude iPad version of it from iPhone resources.

The tester can install the same build in both iPhone and iPad. The concept of universal build is that, the same app will work on both iPad and iPhone.

Related

convert an ipad app to iphone app with custom views

This might be a repeat question.But i have a problem. I have an iPad app functional. The app is built in iOS 6. When i started building it i chose iPad as targeted device NOT universal. Now my client has asked for an iPhone version of it.In my iPad app i keep adding custom views as the client clicks "Add More".I add a custom view which is bunch of textfields, buttons etc.So i copied my iPad app and changed the Targeted device family to iPhone once and also Universal next time and tested it. So when i launch the app in iPhone configuration (keeping the targeted device family as Universal) my view controller stays like that on iPad. I cannot scroll the app also(not up/down..nor sideways). Is this the correct way to convert iPad app to iPhone app . Also everything is still with scale to iPad. Should i start a new project and start everything from scratch.Set the storyboard to fit according to iPhone configuration? In my research people said just change the targeted device family to Universal. But it doesn't work. Please let me know if you need more information. Thanks.
It is possible to convert the current project you have to an app that can be used universally, but it would take more time than simply just creating a new project that allows universal usage, and adding in the files of which you used for your iPad project.
Hint: You can use more than one storyboard when the project was created universally. It will automatically set this up for you.
I would also advise that you separate your files into what works universally, and what is specific for the iPhone or the iPad.
Happy Coding!
After many search i found that it possible to have an application for both Iphone and ipad devices.but in your code you should define unique ui for each device(two xib file).

Can we develop single app for iPhone and iPad

I’m new to iOS development and currently developing an app for iPhone and iPad.
My question is can we develop single app that can run on both iPhone and iPad which match their different screen sizes or resolutions . Or do I need to compile 2 different applications that match the different screen sizes or resolutions in iPad and iPhone?
Thanks.
Yes we can! Universal app is the solution!
Read this blog : http://www.kotancode.com/2011/04/05/ios-universal-apps/
We can develop single app to achieve this. Just select Device family as universal while creating new project. You will get option to prepare different Xib's for iphone and ipad. In code, you can either check for the device or use proper naming while allocating it.
For example,
For iphone -
oneViewController *oneView = [[oneViewController alloc]initWithNibName:#"oneViewController" bundle:nil] autorelease];
For ipad - You can just use "oneViewController~ipad" as xib name. This will automatically load xib for ipad.
you can make one universal app for both iPhone and iPad. Create different layout for both either using storyboard or nib files.
Firstly you don't need to compile 2 different applications that match the different screen sizes or resolutions in iPad and iPhone. There are already universal app in AppStore.
Try this:Universal-iOS-App-Template And this question:iPad/iPhone universal app

Testing universal app on iphone only

I am developing a universal ios app and the iphone version is nearly done and about 50% of the ipad. However I need to get started testing the iphone version. Therefore I changed the project only to be a iphone target. However when the app is on the ipad, the nib files for the ipad version is loaded in the iphone simulator. Therefore you only see a fraction of the ipad screen in the iphone simulator. One solution is to remove the references to the ipad nib files, however I would like to avoid this approach.
Anyone one with suggestions?
Regards
EDIT: The problem is if I want people to be able to test the iphone version on a ipad(some people only have an ipad not an iphone). When running the iphone simulator on the ipad, it would load the wrong nibfiles. Those intended for the actual ipad and not the iphone.
You don't want to "change the project only to be a iphone target". Change it back and just build and run on the device (iphone or ipad depending upon which one you have plugged in).
Btw, in future I STRONGLY recommend that you test early and test often - e.g. test on devices every day.
Okay, it ended up with the solution I did not want to do :) I removed the nib files intended for the ipad and it removed the issue. After the test I will have to add the ipad nib files to continue working.

change iphone project to work in both iphone and ipad

I already have an application which i have built for iphone only. I need to change it to work in both iphone and ipad.the upgrade to ipad application option in project tab of xcode is faded.. which I means I cant do that... I tried to run the project in ipad simulator but it gets automatically run in iphone simulator.
What are the proper steps to change my project to work in iphone and ipad.
Initially change the build setting,ie change the Targeted Device Family field to iPhone/iPad. To write logic for iPad use "UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad" this condition.

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.