Xcode Naming Executables - iphone

Ok.
So I got my first app approved by Apple, it goes on sale this week. With that out the door, I wanted to create a Lite version of the app.
I did a branch in SVN, and created a new working directory.
Original app is Trak4, Lite version is obviously Trak4 Lite
I noticed that when I build, the .app file that Xcode creates is still Trak4.app even though in the plist file, I've changed the Executable name to Trak4Lite, the project was renamed to Trak4Lite, etc.
In Products it says the Product is Trak4 Lite, but at the build step it's generating Trak4.app.
What am I missing? Why is the executable name wrong?
I'm running OS3.0 GM. I'm not running Snow Leopard yet.
Keith

For free versions of my apps, I create a second target in the same project, rather than creating a branch. After you duplicate the target, you just need to change the Product Name setting for that target. I also create a new Info.plist, and point to that in the target settings.

You need to change the Product Name (PRODUCT_NAME) in your target's Build Settings, and you might want to point to a different Info.plist also.
alt text http://web3.twitpic.com/img/13461715-4c0d84c623011739cca45f9b3f44abc3.4a3e605a-full.png

I always get tripped up by that. I've used Rename Xcode Project to help me out.

Related

How to get second version of the same app from XCode?

I have one iPhone with the name of "Sample" in my device. I did some changes on the app for the version two. I want to install the "Sample1.1."(Second Version) app in my device without deletion or replace of first one. I have did below steps,
1. Changed the Product Name "Sample" to "Sample1.1"
2. Changed the ipa file Name "Sample" to "Sample1.1"
I have tried these steps, when i trag the "Sample1.1" ipa to iTunes the "Sample1.1" replaced with the "Sample" app. I want to install these two app in my device. What are the changes i need to do in XCode? Can you please help me? Thanks in advance.
It's not the name that makes the difference, it's the bundle ID in your app's plist file.
Change that, and then you can install two copies of your app.
Create a new target in Xcode, which will give you a second info.plist file. In your second info.plist you can change the app name and bundle ID. you can now compile either app from the same source and install them both on the same device without needing to do any manual editing after you compile.
Click on your project, then there will be project and targets, you can easily duplicate the current "Sample" and make it "Sample1.1". Next to "Run" button, you can select your "Sample1.1" and build it, it will install as different version
You can use a different provisioning profile. Then in setting uncheck the automatically manage signing option and chose the profile you added for signing.

XCode error "The application bundle does not contain a valid identifier."

Recently, after upgrading to Lion and Xcode 4.2.1 I am getting this error when trying to run my app on my iPhone 4S:
"The application bundle does not contain a valid identifier."
My identifier is indeed valid, and I have been able to run my app with this identifier earlier.
The problem might appear when I change computers.
I have two computers that I am using to code my app, and I am using Dropbox to keep track of my files.
Restarting XCode, my mac and my iPhone does not work.
Cleaning the target and rebuilding does not work.
The only thing I have been able to do to fix it is to create a completely new project and moving my files. This made things work until I swapped computer. Now I am in the same trouble again.
Any idea? Anyone?
Three suggestions:
Check that your developer key is in both computers
Did you try to update the project? There is a strangly-named key in the middle bottom under the project's properties. Try this.
I had similar issues. I found that some things weren't updated when I updated osx and xcode. To get out of the situation, I would suggest creating a new project and copy paste code, files and build settings. This might seem stupid, but you know apple is not good at creating IDE's. You might just get your self lost in the undocumented settings.

Why do I get "could not be added to your itunes library because it is not a valid app" error when trying to install Ad-Hoc build?

I've recently upgraded my Mac to Lion, and also Xcode 4.
In Build Settings, I've set "Code Signing" for "Release" to be "iPhone Distribution" which matches our Ad-Hoc provisioning file (which we've used in the past, on Snow Leopard/Xcode 3).
I have deleted the old Entitlements file (as it's apparently no longer used by Xcode 4).
In the Scheme section, I've set Archive to use the Release build.
I'm building with Product > Archive.
I'm saving the file by going into the Organiser and clicking Share, then making sure the same Ad-Hoc provisioning is selected.
I'm sending the resulting IPA file to my boss, who has previously installed this app. When he tries to install it, he gets the message "[appname] could not be added to your itunes library because it is not a valid app".
I've been trying every combination of settings I can think, but we just cannot get this to work. I can find this error only twice in Google - once from someone with a jailbroken phone and another posted in comments of an article, someone having the same issue, but there are no responses.
Any help would be really appreciated.
Edit: Same thing happens trying to drag the IPA into iTunes on the Mac that created it! :(
Edit2: Just taken another (almost identical) project and tried a build without "Modernizing" the project, or selected any of the new options in Xcode (icons, launch images, orientation etc.), and this build works. I'm going to work through each of the things I did with the original app with this one, testing at each step. Hopefully should be able to isolate which step is breaking the compiled app!
(also posted to Apple Dev Forums)
I believe I've tracked this down... It seemed to be happening really intermittently, so it's taken some time (I'd reproduce it, roll back the change, confirm it worked, then re-apply the change, for it to then work again!).
However, after much cleaning/restart/etc., I believe it's related to the "Build" version in the target settings (there are now two version fields, "Version" and "Build"). It seems that if "Build" is blank, then this error occurs.
Unfortunately, changing this value doesn't seem to rebuild properly, so sometimes if you change it, then Archive, you still get the previous value. Manually cleaning before Archiving seems to work around this.
The value gets written into the plist file as CFBundleVersion.
Recently I suffered a problem with an Ad-Hoc installation using TestFlight service, the message in the log didn't help too much:
Jul 25 12:52:39 MyiPad installd[477] <Error>: 0x10059c000 init_pack_state: Archive we've been requested to install is 0 bytes. That can't be a valid ipa.
After many tests, I found this question and the problem was the same, the Build field was empty (this answer save my day :-) )
So, if anyone else has this problem on TestFlight, I hope my answer allows to find this page easier ;-)
I also faced the same issue. After doing some research found below answers as:
App Version and Build version should not blank.
Don't put special characters in my app bundle name.
And also there was no issues with my provisioning profiles.
After debugging found that there was name mismatch in my scheme name and info.plist file name. In my project, I have 3 schemes like a,b,c and only one a-info.plist file. I was creating IPA for different scheme like 'b'.
In your scenario, if you have created multiple schemes then check your Info.plist name. That should have to be same as your scheme name (for which you are creating an IPA).
Example. The scheme name is 'myScheme' then your Info.plist file name as 'myScheme-Info.plist'.
Hope this will help you.
I got the same message ("not a valid app"). In my case, I was FTPing the built app to a web server then I would be able to OTA provision it. I was not swapping to binary mode before I was putting the file, so the .ipa file got corrupted on the way. Took me most of the evening to figure that stupid mistake out...
ok.. do one thing.. Open info.plist.. Go to bundle identifier and change bundle identifier name. It needs to be unique.. something like "com.yourcompany.projectname" and create and try to install the ipa.. It should work
I came across this question while researching a similar problem so I'll answer here even though the cases are not identical, because others will search for the same error message.
I had an ad-hoc app that everyone in the development team could install fine, except one person, who got the error from iTunes:
X is not a valid app
He had been able to install earlier versions of this app. Rebuilding the app, changing the version number and changing the build number had no effect, he still could not install but others could.
I fixed it by creating a brand new Xcode project, either copying the files or copying and pasting the content of the files from the old project to the new one, and rebuilding the app and signing it in exactly the same way as the old project. It worked.
I had a similar issue while trying to create an .ipa for adHoc distribution for one of the Old project (built a year ago by ex-developer). After a lot of research in google and following the above solutions it didn't worked out for me somereason.
Later after following this link - here. By replacing the .plist file with the existing working projects (obviously - the relevant icons/bundle display name/identifier) and renaming with the current .plist name. It worked for me.
I literally spent about 3-4 hours to fix this issue. Hope it helps some one.
environment was native - iOS app.
add......
"Application requires iPhone environment" in your info.plist or if added give it value "YES".
Check "Build" and "Version" in general are not empty....
hope this will work
Importing the project contents in to a new Project solved the issue for me.
For me, we were trying to do an enterprise build of a very old app, from iOS 5.
After confirming profiles and everything else was fine, debug builds work correctly, I noticed the general consensus was around issues with the info.plist file.
I compared the info.plist with another app and sure enough,
Application requires iPhone environment = NO
Basically this key needs to always be set to YES for iOS apps regardless whether its for iPhone, iTouch or iPad...
It may not be limited to that key for everyone but make sure the info.plist looks similar to working apps.
Bundle version
Bundle versions string, short
should always be present!
right.. but I guess it is clashing with earlier bundle identifier( this happens because you have upgraded the Xcode). Did you try and change the existing bundle identifier name and install ? I had identical problem and wasted 3-4 days.. I changed existing bundle identifier name and it worked.. Also you may want to check Bundle name and Bundle version are present in info.plist

Why does my XCode project include the wrong icon file for my iOS Application?

I am creating a lite version of my app, and used Chris Fletcher's blog here as a guide to setting up an Xcode project for multiple apps. I have everything working great except for the icon file.
Here is an overview of what I have:
2 info.plist files (One for each version of the application)
In my paid info.plist, I reference the icon "IconPaid" for the Icon entry. In my Xcode project, I have added IconPaid.png and IconPaid#2x.png.
In my lite info.pist, I reference the icon "IconFree" for the Icon entry. In my Xcode project, I have added IconFree.png and IconFree#2x.png.
When I go to build both apps, my lite app shows up with the paid icon. I took a look at the package contents of my lite app, and sure enough the IconPaid files were included but not the IconFree files. I took it a step further, and printed out the value for the CFBundleIconFile in my app, and it correctly shows up as "IconFree".
So my question - Where else is the icon file referenced in a Xcode project besides the plist file? I thought that was the only place...
It sounds like your free target is copying the paid version of the icon instead of the free version. Look under Targets/Project-Name/Copy Bundle Resources and check that the free version is copying the correct icon file.
I'm not sure why the IconPaid.png is showing in the free app (assuming your build settings of your free target are referencing the proper info.plist). You may want to clean all targets and delete your intermediate build files too, and delete the old version from your simulator or device.

What files to keep under version control on iPhone projects?

I found this previous question about Cocoa projects, but I wanted to know if it's the same for iPhone projects.
As far as I know, the same responses there apply to iPhone development as well. In my projects, the only files I keep under SVN's control are the source files, any resources (images, .XIBs, audio, etc.), and the .xcodeproj file.
It may be a good idea to version control provisioning profiles. Especially for an ad-hoc beta test profile, you'll need to update it every time you add a new beta tester, and having a history of that seems like a good idea.
Actually there is something I would say you should version control that you would normally not - the final application bundle and dsym file, both under build. However, you only need to archive these when you release either an ad-hoc or distribution build for the store - so I'd leave build in the ignore file, but have somewhere you can copy these files to check them in for a distribution and tag them along with the source.
You'll probably want to compress the app bundle before placing it in this save directory
You need these two files in order to be able to symbolicate crash logs sent to you by either beta testers, or users of the app from the app store. A meaningful stack trace of a crash is priceless!
If you're planning on updating the app over time in addition to project sources and media you may also want to put the following under version control:
Signing certificates for app (and/or mobileprovision files).
The final version of the binary app (zipped) submitted to Appstore.
Binary.dSYM file for each revision (for post-release crash symbolicating).
Screenshots/icons/text file of description for app as submitted to Appstore.
Before beta releases you may also want to put mobileprovision files as well as a snapshot of the device list from the Developer portal for that version just so you can go back in time and figure out who got what release. If you're really hardcore you can also keep emails submitted by beta testers so you can keep it all in one place and go back and double-check against bug reports.
Yes. I use the exact same .gitignore file for iPhone OS projects as I do for Mac OS projects.