Cannot find docs for Universal apps!

So Ansca just released .268 that includes In-App and Universal builds, but im having a hard time finding documentation on how to properly make a universal app.

Do I just use dynamic content scaling and when I compile my app for sale just check off Universal?

Thanks for any clarity!

-Kyle

+1

I was just about to ask the same.

It's supposed to be so easy, that it doesn't need docs :P

Seriously though, you bring up a good question. The truth is that the Universal feature merely provides you the ability to ship a single binary that works natively on iPhone/iPod touch and iPad. So when you run on iPad, you won't get that iPhone sized screen anymore with the 2x button.

How your app decides to present itself is still entirely up to you. Content scaling seems perfectly reasonable and probably the easiest thing to do. However, should be possible to still present completely different UIs for each device even in a Universal Binary. The strategy would be to detect which device you are on and do different things accordingly.

I know you're joking, but I disagree. For one hidden a forum post about a Corona remote you'll find critical information in setting up your icons to avoid an error when sending your app with Application Loader for example, that should definitely be in the docs.

Also on the scaling, will Corona use the @2x images we use for retina displays also for iPad, do we have to make new ones? How do I tell Corona to use the @2x files for iPad if I'd rather not make new ones for every single asset? Sure I can experiment, but if the answer is already known I'd rather not waste time.

In order to detect iPad I'm assuming we should continue to rely on the display.contentScaleX trick? (which is also very weakly documented I might add). I'm assuming that since now it's native iPad will the the correct display.contentScaleX value (before it was just iPhone's understandably).

I think I want to make new background images that fit well on the iPad resolution, but I want to keep my other assets the same as the @2x retina ones.

I have a working example of an app that auto-adjusts layout in a universal builds with scrolling list views. I'll post it as soon as I get a chance. I'm in an airplane that's about to take off right now. ...or if you're in Rotterdam I could show you in person. :)

It is really easy. The content scaling is one thing, building another. Here are the build settings for a universal app, you need to include all the icons at the correct sizes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
settings =
{
        iphone =
        {
                plist =
                {
                        CFBundleIconFile = "Icon.png",
                        CFBundleIconFiles = {
                                "Icon.png" , 
                                "Icon@2x.png" , 
                                "Icon-72.png" , 
                                "Icon-Small-50.png" , 
                                "Icon-Small.png" , 
                                "Icon-Small@2x.png"
                        },
                },
        }
}

The iPad gets the @2x graphics unless you provide an even higher resolution.

The build settings are on the api page for build settings also.

I had to figure it out without any help, that was painful!

What about transitions that are moving objects to specific x/y? does the new build account for that?

I agree with Ignacio, you don't release something w/o proper documentation, then we'll have a painful learning like Matthew had.

Sorry. We'll try better next time. We underestimated how much we needed to say about this. (We were really worried about In-App purchases as being the really difficult one to understand...Sample App, API documentation, and high-level documentation. And there is actually a 35 minute video we are still trying to edit down.)

As for your question, the mental model you need to get in your head is that a Universal Build is just combining two separate binaries (iPhone and iPad) into one single binary. The behavior of your code doesn't necessarily/automatically change because it is Universal.

So for example, let's say you already had a single code base you wrote that you compiled twice (once for iPhone, again for iPad). When you run the iPhone binary on iPhone, it does what you want. When you run the iPad binary on iPad it does what you want.

Now instead of building two binaries, you build as Universal and get one binary. But that single binary should behave exactly like before in our two cases. When you run on iPhone, it behaves exactly like your old iPhone-only binary. When you run on iPad, it behaves exactly like your old iPad-only binary.

Hi everyone,

I just posted some sample code to show some of the great possibilities that you can take advantage of in your apps with Universal Builds in Corona. Universal Builds are a feature I'm really excited about.

Matthew Pringle has pointed out some cool stuff you can do to make sure your graphics look sharp on hi-res screens. The code I'm posting here (scroll to the end of this post for the download) deals with handling the screen layout on different devices.

A while back I posted this tutorial on the blog:

Create scrolling list views with text and graphics in Corona
http://blog.anscamobile.com/2010/09/create-scrolling-list-views-with-text-and-graphics-in-coronasdk-ios-android-tutorial/

Then I posted an update to the sample code for the tutorial to show how easy it would be to modify the code to get the same app to run on an iPad as a split view with the scrolling list on the left and the details on the right. http://blog.anscamobile.com/wp-content/uploads/2010/09/CoffeeDemo.zip

Before Universal Builds you had to build two separate apps from this code to use it on the iPhone and iPad. Now you can build once and your users choose which device to put it on.

One of the keys to getting this to work on both devices from the same binary is to add an if-else statement to the config.lua file.

In my old code, I asked the developer to comment and uncomment certain lines to prevent auto-scaling on the iPad. With a Universal Binary, you don't have control over where the user is installing it--on an iPhone or an iPad. So the if-else takes over:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if system.getInfo("platformName") == "Android" then
        application =
        {
                content =
                {
                        --zoom
                        width = 320,
                        height = 480,
                        scale = "letterbox"
                },
        }
elseif system.getInfo("model") ~= "iPad" then   
 
        application =
        {
                content =
                {
                        --zoom
                        width = 320,
                        height = 480,
                        scale = "zoomEven"
                },
        }       
end

Hi,

The thing needed here is not how to actually make the app scale correctly, there's plenty of places where you can get that.

It is about the build settings and what you need (icon, default image) and how it has to be named to actually make the universal build pass the app loader test.

I think you could probably fix this page (especially near the Customisation section):

http://developer.anscamobile.com/content/building-devices-iphoneipad

To explain what you need to make a universal build.

Thanks

This is really helpful! I have some more questions that maybe Gilbert or Matthew can answer...

Matthew, you have all the icon sizes in a plist with the "iphone" heading. Does that mean the iPad will pull the icons from that list as well? In my current build.settings, I also have an "ipad" plist as well. Right now, the iPad parameters are identical. Do I need separate ones for iPhone and iPad? And what about iPod?

Does the iPad know to grab the 72x72 icon (Icon-72.png) for it's screen display?

I understand that the 512x512 icon for the iTunes store is not a part of the build settings, and that we upload it separately. So I assume that means it should not be in the project folder?

Are all the iTunes icons based on this 512x512 icon? In other words, is Apple automatically scaling it down for its various screens, like the main app listings where I see 75x75 icons?

I also have questions on the Default.png launch images used during the load process. How do we tell the app which one to load for iPhone vs iPad? The Corona docs doesn't seem to specify that. Apple docs (http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BuildTimeConfiguration/BuildTimeConfiguration.html%23//apple_ref/doc/uid/TP40007072-CH7-SW1) that I can add -iphone or -ipad to the name, but Corona doesn't seem to understand that in the simulator.

Finally, I see in the above Apple doc that the build image for the iPad should actually be 768x1004 for portrait and
1024x748 for landscape. I assume the 20 pixels they knocked off the size is for the status bar? But if I've turned off the status bar in my build.settings file, should I stick with full-sized images?

Thanks!

For universal apps the above settings work for the iPad, all icons show in their correct places.

The separate 512px icon, Apple will resize that and you dont / shouldn't put rounded corners on that either.

The default images for the iPad, yeah sizes quoted for the status bar but a full 1024 x 768 is allowed for full screen apps.

If you need to know more, see how things need to be setup in xcode and rewrite in the above method. Thats what I initially did, obviously testing on each device where possible will help.

Application Loader will also scan and reject the app if you do anything wrong and provides hints as to what is missing.

The app I released is for iPad as well and everything worked like a charm, even the default images for the iPad.

Hi Matthew,
Not sure if possible or too inconvenient, but could you post a sample with what you're talking about (a zip file on code exchange or here) for us to download and actually see image dimensions and file settings (build, config, main, etc)?!

It would've been better if Ansca would take that initiative, but in the mean time, I think you're our guy :P

Thanks,
RD

Heres a default setup for an iPhone app which, with content scaling will resize to iPhone 4 and iPad and load correct icons, default.pngs etc...

http://www.coronaremote.com/downloads/setup.zip

Cool, although everything is 'blank/black', I think I get the point.

I was just wondering how all other objects/images (besides default/icon) needed to be setup.

Thanks,
Raul

Thanks Matthew, this is very helpful!

I agree this kind of stuff SHOULD be much better documented!

Corona Guys - how about making this more technical stuff available to subscribers only? should pay for itself...

anyhow can someone please tell what the icon-small and variations are for? the others I understand.

Note you can't search for icon-small on the website. Forums and blog search tools are no substitute for detailed documentation

Great post / thread otherwise

Icons and stuff like that is well documented on Apples developer website.

The small icon for instance is for the search screen.

views:2212 update:2011/10/10 15:46:04
corona forums © 2003-2011