I've got a problem with my universal app that I just recently ported to the iPad.
While it works fine on the iPad, on the iPhone 3G it shows Default.png and then goes to a black screen.
It even showed the home screen after Default.png once, with all the icons messed up - and the home screen was still scrollable.
I've tried everything to get it working - cleaning the app and deleting then reinstalling the app but they don't seem to work.
I've rebooted my Mac and my iPhone but doing so doesn't seem to work.
Also - the app works fine in the iPhone simulator, so I'm wondering if it's my device.
Update:
I converted the app to a universal application using Xcode's 'Upgrade current target for iPad' function so there are different XIB's for each device.
I also don't have any other device to test it on - just an iPhone 3G and an iPad.
Problem solved. Rather easily actually - in Xcode's upgrade process, it changed an entry in the plist to not find MainWindow. It changed the entry 'Main nib file base name' to 'Main nib file base name (iPhone)'. I don't think the iPhone knew where to look for the nib because its plist entry was changed.
Related
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.
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.
I have a universal app built that runs and works perfectly on an iPad, iPhone 4G, 3GS & 3G, but when run on an iPod Touch 4G it won't run properly.
I don't have a iPod Touch to test, but I have been told by a beta tester that it installs on the device fine, but when run it shows the Default.png from the iPad version of the app squashed into the screen when launched, then just goes black from there. When the app is force quit (using the app switcher) and re-launched it does the same thing again.
I have double checked that the Targeted Device Family is iPhone/iPad and done a clean build etc. but still no dice.
So after some trial and error I worked out what the problem was (actually two separate but related problems):
In my info.plist I was using two keys to assign the different MainWindow files:
Main nib file base name (iPad)
and
Main nib file base name (iPhone)
I mistakenly thought the second key would apply to the iPod Touch also as there is no Main nib file base name (iPodTouch) key. Turns out this is wrong and the iPod Touch actually looks for the Main nib file base name key. So now I have it setup like this:
..and it's working fine in 3.1.3 & 4.2. (Note that application:didFinishLaunchingWithOptions is not called if the device can't find a MainWindow to use, that's how I worked out the problem).
I suspect the same will apply to the Launch image (iPad), Launch image (iPhone) and Launch image keys, which would explain why the iPod Touch is using the iPad launch image but haven't been able to try it yet.
Make sure the Default.pngs are correctly named:
Default.png (Default)
Default~iphone.png (iPhone or iPod touch)
Default~ipad.png (iPad)
For the iPad resources you can also specify certain default PNGs for each orientation.
There's currently a jailbreak technique that uses some of the iPad firmware to install on an iPhone or iPod Touch. In theory it shouldn't affect anything, but I've never done it myself so I can't vouch for that. You might ask if this tester is on a jailbroken device, and if so try on a non-jailbroken device.
I am not sure it will work, but it may help you.
Make sure that, in the InterfaceBuilder, the attribute(visibleAtLaunch) in main window is checked.
Some times if it doesn't checked then it will show black screen.
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.
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.