Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-19-2008, 01:47 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Clinton Twp, MI
Posts: 106
Default Lite Game: Duplicate Xcode Project

Is there a good way to duplicate an xcode project so i can use the same basic game, but cut out a bunch of stuff for a "lite version".

i've tried just copying the folder and renaming the xcode file, but when I build there is only 1 version of the app on the simulator - it just replaces the "full version".
rjgrune is offline   Reply With Quote
Old 12-19-2008, 02:26 PM   #2 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

Don't create a separate project. Just add a second target to the existing project.

In the build settings for the new target change the "Product Name" setting to "ProductLite" or something similar.

You should also end up with a new file in resources named "Copy of Info.plist" (or something similar). I usually rename this to "InfoLite.plist". Then in the build settings for the new Lite target your created change the "Info.plist File" setting to match whatever you renamed the file to.

You'll want to create an IconLite.png and update the InfoLite.plist to reference the new icon file.

With this all in place you should now be able to build two targets - the full version and the lite version. They will now have different app names (based on the Product Name change so they can both be deployed at the same time. They will have unique bundle ids so they can be submitted to Apple as separate apps.

Now the last part. For the Lite target, edit the build properties. Scroll way down the list of settings to the "GCC 4.0 - Language" group. Make sure "All Configurations" is selected and edit the "Other C Flags" setting. Set it to something like:

-DLITE_VERSION

Now in your code you can do things like:

Code:
#ifdef LITE_VERSION
    // Code specific to lite version
#else
    // Code specific to full version
#endif

// Or

#ifdef LITE_VERSION
    // Code specific to lite version
#endif

// Or

#ifndef LITE_VERSION
    // Code specific to full version
#endif
RickMaddy is offline   Reply With Quote
Old 12-19-2008, 02:56 PM   #3 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Clinton Twp, MI
Posts: 106
Default

Quote:
Now the last part. For the Lite target, edit the build properties. Scroll way down the list of settings to the "GCC 4.0 - Language" group. Make sure "All Configurations" is selected and edit the "Other C Flags" setting. Set it to something like:
I'm not quite sure where this is in my build settings. I highlight my targetLite and click the info button to edit the build settings. "All Configurations" is selected...where do I find the "Other C Flags" settings?

Also, at this point before doing your last step when I build to the simulator for my TargetLite I always get an "Error From Debugger: Failure to launch simulated application: Unknown Error"

Thanks for this, I am much further along then I was before.
rjgrune is offline   Reply With Quote
Old 12-19-2008, 03:03 PM   #4 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

The GCC 4.0 sections only seem to show up if you select the right combination.

On your main project window select the drop down list that lets you quickly pick the SDK, configuration, and target. Select the one the says "Use Project Settings". The drop it down again and select your new Lite target leaving all the others checked as-is. Now your build settings should include all of the GCC 4.0 sections in the settings list.
RickMaddy is offline   Reply With Quote
Old 12-26-2008, 07:55 AM   #5 (permalink)
Registered Member
 
Join Date: Sep 2008
Location: Brasilia/DF - Brazil
Posts: 55
Default

Hey RickMaddy, thanks for the tip!!! Helped a lot.

Here is another tip: How to maintain two Default.png files, one for the full version and another for the Lite version in the same project:

- Create a Default.png file for the full version and a DefaultLite.png file for the Lite version. Add both to the Resources folder in your xcode project.
- Right click on your lite app Target, click Add, New Build Phase, New Run Script Build Phase.
- Paste this code in the script field:
Code:
mv ${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/DefaultLite.png ${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Default.png
- Move the "Run Script" phase you just created right after to "Copy Bundle Resources"

That's it, everytime you build the project with the Lite app target it will copy the DefaultLite.png and rename it to Default.png in your build dir.
__________________
Want to download documents directly from Safari and save them for offline reading? SaveMyDocs
Send emails with emoji that can be seen by any HTML email client EmojiEmail
eduz is offline   Reply With Quote
Old 12-26-2008, 10:53 AM   #6 (permalink)
New Member
 
Join Date: Dec 2008
Posts: 26
Default

Using this method is it possible to selectively add which resources get copied into the binary? For example, our game binary is about 40 megs, if we were to do a Lite version, we can probably knock it down to under 10 megs by removing stuff we won't need in the Lite version.

If its possible, any suggestions as to how to do it? Thanks.
Knight is offline   Reply With Quote
Old 12-26-2008, 12:31 PM   #7 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

If you right click on a file and select "Get Info" you will see a Targets tab. Select that tab. Then check/uncheck the appropriate targets for that file.
RickMaddy is offline   Reply With Quote
Old 01-04-2009, 06:34 PM   #8 (permalink)
New Member
 
Join Date: Dec 2008
Posts: 26
Default

Thanks RickMaddy.

This thread has helped a lot.

One thing I can't seem to get working is using a different icon for the Lite version. I am using 'iconLite.png' for the Lite, and the full version uses 'icon.png'. I am seeing the default white blank icon when I do this.

Any ideas?

Last edited by Knight; 01-04-2009 at 06:38 PM.
Knight is offline   Reply With Quote
Old 01-04-2009, 07:22 PM   #9 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

Did you change the icon property in the corresponding info.plist for the lite version? Make sure the case matches too.
RickMaddy is offline   Reply With Quote
Old 01-04-2009, 09:52 PM   #10 (permalink)
New Member
 
Join Date: Dec 2008
Posts: 26
Default

Ah jeez, I suck. The icon for the lite version was set to full version's target, so it never got included when building the lite.

Thanks RickMaddy. Your post made me go check everything and was able to find it. Sorry for wasting your time. Its always the little things that one forgets.
Knight is offline   Reply With Quote
Old 01-18-2009, 08:18 PM   #11 (permalink)
New Member
 
Join Date: Jan 2009
Posts: 4
Default

One thing I had trouble with was using Project->New Target... to create the new target. This was failing consistently. Turns out the info.plist that gets created when you do this isn't complete. Instead, selecting the original target and choosing "duplicate", then following the rest of the directions, works fine.
bit101 is offline   Reply With Quote
Old 04-01-2009, 03:54 PM   #12 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: irvine, ca
Posts: 19
Default

Quote:
Originally Posted by RickMaddy View Post
The GCC 4.0 sections only seem to show up if you select the right combination.

On your main project window select the drop down list that lets you quickly pick the SDK, configuration, and target. Select the one the says "Use Project Settings". The drop it down again and select your new Lite target leaving all the others checked as-is. Now your build settings should include all of the GCC 4.0 sections in the settings list.

Alternatively, you can just create a user-defined entry named "OTHER_CFLAGS"
tommy-personatap is offline   Reply With Quote
Old 05-07-2009, 08:19 PM   #13 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 97
Default

always grateful of rickmaddy's answers.
I tried this, but i just get
"failed to launch simulated appliation: unknown error"
when i try to launch my new lite target.

when creating the target, so i have to specify what to build?
I tried adding my full version app as a dependency, but that didnt work either.
roocell is offline   Reply With Quote
Old 05-07-2009, 08:37 PM   #14 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 97
Default

answered my own question yet again.

1. if you create your new target from the top menu, you'll have to drag all the resources, files from your original target to the new target. This is how it knows what to build.

2. i didnt try it, but I think you could just right click on the original target and click duplicate. This is save some trouble.
roocell is offline   Reply With Quote
Old 05-20-2009, 06:22 PM   #15 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: London/Peterborough
Posts: 533
Default

Quote:
Originally Posted by roocell View Post
answered my own question yet again.

1. if you create your new target from the top menu, you'll have to drag all the resources, files from your original target to the new target. This is how it knows what to build.

2. i didnt try it, but I think you could just right click on the original target and click duplicate. This is save some trouble.

Step 2 worked for me, I'm using the latest xcode for iphone os 3.0
QuantumDoja is offline   Reply With Quote
Old 05-21-2009, 12:03 AM   #16 (permalink)
Registered Member
 
brendand's Avatar
 
Join Date: Aug 2008
Posts: 223
Default

Should the bundle identifier be changed also? My bundle identifier is com.clickspace.tapforms for my regular. Should the lite one be something like com.clickspace.tapformslite?

It would be nice if a user could upgrade to the full version and keep their database. But I guess that's not really possible. Well, I can keep the backup function in the lite version so they could backup their database and then restore to the full version if they upgrade.

Last edited by brendand; 05-21-2009 at 12:12 AM.
brendand is offline   Reply With Quote
Old 05-22-2009, 08:00 PM   #17 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 61
Default

I'm having trouble creating a lite version that does not replace my full version. I copied the folder for my full version and in this I changed the code for my lite. I created a new target by duplicating the old and renaming it to lite I also changed the Bundle identifier but it does not seem to matter they both still overwrite the other if I try to install it on my device.

I read above that Product Name should be changed but Product Name is Blank in my full version. I tried to add a value there but it did not seem to make a difference.

I'm also noticing that under products the two .app files have the same name.

what am I missing?

Last edited by Kazooless; 05-22-2009 at 08:09 PM.
Kazooless is offline   Reply With Quote
Old 05-22-2009, 09:36 PM   #18 (permalink)
Registered Member
iPhone Dev SDK Supporter
 
Join Date: Mar 2009
Posts: 292
Default

the Ifdef statements are neat, i'm gonna read up on that tonight when I get home.
odysseus31173 is offline   Reply With Quote
Old 05-23-2009, 03:07 PM   #19 (permalink)
Developer
 
Join Date: Sep 2008
Posts: 34
Default

Quote:
Originally Posted by RickMaddy View Post
Did you change the icon property in the corresponding info.plist for the lite version? Make sure the case matches too.
I created 2 apps, version a and version b. Using this method, of creating a different target for each version. When debugging, and even in release mode, the icon in the device is the one I set on the infoVersionA.plist, and infoVersionB.plist. But after uploading the app to the appstore, the icon that appears on the appstore on the device is the same for both apps. So for example, I have one icon named, icon.png, and another iconVersionB.png. I included both files, both the .plist files define which icon is which. Do I need to do something else, or is this an appstore error? Any ideas. Also, If I download the apps from the AppStore, once installed on my device, the icons are correct for each version.

Thanks.
__________________
http://www.tiltmeterapp.com
My Apps: Tilt Meter Pro
:apple:Unibody MacBook Pro 2.53GHz, 4GB RAM, 300GB HD;
24" Aluminum :apple:iMac, 2.4GHz,2GB RAM, 300GB HD; 15" :apple:iPhone 3G 16GB
CarlosH is offline   Reply With Quote
Old 05-23-2009, 03:16 PM   #20 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: London/Peterborough
Posts: 533
Default

Quote:
Originally Posted by CarlosH View Post
I created 2 apps, version a and version b. Using this method, of creating a different target for each version. When debugging, and even in release mode, the icon in the device is the one I set on the infoVersionA.plist, and infoVersionB.plist. But after uploading the app to the appstore, the icon that appears on the appstore on the device is the same for both apps. So for example, I have one icon named, icon.png, and another iconVersionB.png. I included both files, both the .plist files define which icon is which. Do I need to do something else, or is this an appstore error? Any ideas. Also, If I download the apps from the AppStore, once installed on my device, the icons are correct for each version.

Thanks.
Dude, you're not making two xcode projects are you?
QuantumDoja is offline   Reply With Quote
Old 05-23-2009, 03:20 PM   #21 (permalink)
Developer
 
Join Date: Sep 2008
Posts: 34
Default

Quote:
Originally Posted by QuantumDoja View Post
Dude, you're not making two xcode projects are you?
Nope, is just one project, with 2 targets. With conditional compiling, and different info.plist files. They work pefectly, and downloading the app from the appstore works as expected, with the correct icon. The problem is the icon that appears in the Appstore on the device. It appears as if the Appstore looks just for an icon.png file, instead of the icon file I set on the info.plist
__________________
http://www.tiltmeterapp.com
My Apps: Tilt Meter Pro
:apple:Unibody MacBook Pro 2.53GHz, 4GB RAM, 300GB HD;
24" Aluminum :apple:iMac, 2.4GHz,2GB RAM, 300GB HD; 15" :apple:iPhone 3G 16GB
CarlosH is offline   Reply With Quote
Old 05-23-2009, 09:24 PM   #22 (permalink)
Registered Member
 
tawpie's Avatar
 
Join Date: Jul 2008
Posts: 347
Default

Quote:
Originally Posted by CarlosH View Post
[snip]The problem is the icon that appears in the Appstore on the device.[snip
Confused. Do you mean that when you go to the appstore using your device, that the icons for both a and b are the same? Yet when downloaded they are different (and correct)?

Is it possible that you used the same 512x512 appstore .jpg for both when uploading?
__________________
"Hardware will break. Software comes broken" Unknown
Calc-12E <-- ditch your old calculator.
CPR•Choking <-- Review your training, just in case. (Free)
All of Nature NW <-- scrolls in x and y, with pinch zoom AND scrollable text to boot. It can be done ('taint easy tho)
tawpie is offline   Reply With Quote
Old 05-23-2009, 09:33 PM   #23 (permalink)
Developer
 
Join Date: Sep 2008
Posts: 34
Default

Quote:
Originally Posted by tawpie View Post
Confused. Do you mean that when you go to the appstore using your device, that the icons for both a and b are the same? Yet when downloaded they are different (and correct)?

Is it possible that you used the same 512x512 appstore .jpg for both when uploading?
They look the same in the appstore listing, on the device. The 512x512 images are correct, and they show correctly on iTunes, on the mac. So since the icons that appear on the appstore listings on the device come from the bundle, so I think the problem has to be related with targetting 2 apps.
__________________
http://www.tiltmeterapp.com
My Apps: Tilt Meter Pro
:apple:Unibody MacBook Pro 2.53GHz, 4GB RAM, 300GB HD;
24" Aluminum :apple:iMac, 2.4GHz,2GB RAM, 300GB HD; 15" :apple:iPhone 3G 16GB
CarlosH is offline   Reply With Quote
Old 05-23-2009, 10:49 PM   #24 (permalink)
Registered Member
 
tawpie's Avatar
 
Join Date: Jul 2008
Posts: 347
Default

Sounds like your first theory was well founded... the appstore app must use Icon.png, I wonder what happens if there isn't an Icon.png in the bundle? One would hate to experiment with a live app but if you didn't use Icon.png in either app would they show anything?
__________________
"Hardware will break. Software comes broken" Unknown
Calc-12E <-- ditch your old calculator.
CPR•Choking <-- Review your training, just in case. (Free)
All of Nature NW <-- scrolls in x and y, with pinch zoom AND scrollable text to boot. It can be done ('taint easy tho)
tawpie is offline   Reply With Quote
Old 05-24-2009, 03:41 AM   #25 (permalink)
Registered Member
 
brendand's Avatar
 
Join Date: Aug 2008
Posts: 223
Default

Did you include Icon.png and iconVersionB.png in both targets? Make sure that each one is in its own target so that your bundle will only include one or the other, but never both.
brendand is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Stats
Members: 157,873
Threads: 88,917
Posts: 379,300
Top Poster: BrianSlick (7,072)
Welcome to our newest member, monadarn8
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:34 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0