Can an Xcode project with multiple targets have different Settings.bundle's for each target? - iphone

I have a settings bundle in an iPhone app which has several subtle variant targets.
The problem is I need to customise some strings in each settings bundle to make them appropriate for each target. It appears that if the Settings bundle is named anything other than Settings.bundle it won't pick up the bundle (understandable, can I specify in a plist somewhere the alternate name?).
If I try and put them in different folders and call them the same thing Xcode gets horribly confused and lets you edit "2 files" that are actually the same single source.

I see no problem. For every target, create a specific folder with files for this target. Now create a group in Xcode for every of those folders and drag each of the new Settings.bundle directories to the corresponding group. When adding the bundles to the project, make sure that every bundle is only built (included) for its target by checking the appropriate box.

AFter you do what MrMage said which is correct.. i had an issue where the Root.plist would not show up under the Settings.Bundle for a specific target.
You have to let xcode know what the setting.bundle file is... click on the settings.bundle that wont show the Root.plist, then go to file inspector
Alter the file Type drop down to be applicationBundle ... now the Root.plist shows up.

Related

AppName doesn't change, after renaming in xcode

I have two apps which are 90% same.So I have used the same code and renamed it in xcode.After that I have installed it in my device.So it is giving the previous appname not the new name.So Kindly tell me.Let me know if you need any more details.
If you are refering to the label inside the app icon in the springboard (the iPhone "desktop") , you will need to open the YourApp-Info.plist (located, usually, in Supporting Files) and change the value for Bundle display name (or CFBundleDisplayName).
go to your Xcode project, select the desired target, click on "Build settings" and look for "Product Name", now enter the new desired name.
To change the name of the app on the iOS home screen, you need to change the CFBundleDisplayName key in your app's Info.plist file.
https://developer.apple.com/library/ios/#documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-110725-TPXREF135
As everyone say, the bundle display name is the name displayed on your device.
You might want to change the bundle identifier too, but it's for corresponding to your provisionning profiles and to be posted on another identifier on the app store.
You might want to rename your Xcode project, I found yesterday a way to do this easily: click on your project name (on left panel), go on the right panel (open it if not) and change the "project name" textfield. it will ask you to rename lot of files automatically.
Finally, have you considered to create a new target, instead of creating a new project ? If the differences are just images and nib file, you can duplicate an app easily, this way.

How to get root.plist to recognize types provided by InAppSettingsKit

I'm having a hard time integrating InAppSettingsKit. First of all, XCode isn't recognizing that the settings.bundle I've added to my project actually contains files. So I have to open that bundle through the Finder to get at the root.plist file.
When i open it, the preference items are restricted to the basic types such as Group, Title, etc and if I try to use something provided by IASK such as PSGroupIdentifier, it immediately reverts to Group.
What am I missing here? What tells the plist file what types are allowable?
First, to see the contents of Settings.bundle, click on it, and in the right pane (the inspector), set File Type to "Application Bundle".
As for Root.plist, these are items that are being used specifically in the Settings app, and as such are limited to a fixed number of options. When you view it from inside XCode, you will see that when you create a new entry, there are only certain entries you can create.

Hierarchical iPhone Settings File problem -- Can't add to Settings.bundle

I'm trying to add an additional iPhone Settings File type to my Settings.Bundle and reference it in my Root.plist as a Child Pane type, but it isn't working. I've followed the documentation from Apple here, but it will not keep the plist file as an "iPhone Settings" type. I'm assuming that is why I can't drag it to my Settings.Bundle file either.
Basically, add a new plist by selecting File > Add New File...; select Resources under iOS, and then select plist type.
Now add some plist properties to the file.
Now right-click and choose "Property List Type" and select "iPhone Settings." You'll notice the keys in the file change. That's good. Save.
Now, click on another file to view that file and click back to the new settings file. Did it change back to the old property names and property type? It does for me, so it's staying as an iPhone Settings file type, and thus isn't working.
Anyone else have this problem? I'm wondering if it is an Xcode thing, or if it's a project preference/option/setting that I need to change.
One obvious thing that caused me to waste some time: kill the settings app after making changes.
It still doesn't save the settings type, but I got it working by copying the plist file into bundle from the command line. You can also right-click the "Settings.bundle" file and select "Show Package Contents" and copy the file in Finder.

Change name of iPhone app in Xcode 4

I want to change the name which is displayed below the app icon on the iPhone screen.
I use Xcode 4 and I have one target with keys:
Bundle display name : ${PRODUCT_NAME}
Bundle name : ${PRODUCT_NAME}
What I want, my project name is for example "test" but I want to have "MySuperApp".
So, where can I change it best? Is there a place where I can change ${PRODUCT_NAME}?
Are there any other places where I have to change it?
Answer without file rename
Note that an answer that does not require file rename is below.
Answer with file rename
OK, here is what I found, took me a bit of hunting after reading this post, so hopefully this answer will help everyone:
1.In the project contents pane at left, click the Folder icon.
2.Select the top-level blue line representing the project.
3.If you don't have the Inspector pane (right pane) open, click the button to enable it. This is the third button in the "View" toolbar towards the upper right corner.
4.In the Inspector pane, click the little folded-corner paper (file properties) icon.
5.First thing is Project Name. Type in a new one, you will be prompted to rename project content files.
I should add, this will leave your old app with the original name in the simulator, so you still need to delete it from the simulator. Also any files you created in the old app bundle will not be brought forward to the new bundle (unless you find them in Finder and move them over).
(EDIT:) One more important note. Renaming your bundle will mean that the App Bundle Identifier you registered with Apple Provisioning Portal will no longer work for that app. You will need to generate a new App ID and Provisioning Profile in order to distribute your app to a physical device.
In Xcode 4, select your target, "Info" tab, and set the "Bundle display name" field to the name you want (i.e. "MySuperApp"). This is the simplest, pain-free solution.
All other answers described here do not address the original posted issue: "I want to change the name which is displayed below the app icon on the iPhone screen." The upvoted answers of: Woody, Jay, and youshunei are OK but they will all change the displayed name AND either:
A) change your App Bundle Identifier and cause an incompatibility between your app and the Bundle Identifier you registered with the Apple Provisioning Portal (which is a problem if you have already distributed your app or intend to submit the app)
OR
B) result in scheme issues that others have mentioned (i.e. needing to delete/re-create existing schemes)
Change it in the build tab of the targets settings page
As clarification: select targets, select the target you are building, get info, select the build tab, write 'product name' in the search box, and change it there.
On Xcode 4, you click on TARGETS name 2 times (not doubclick), change name and restart Xcode. It's worked for me, that's simple.
You want to change the Bundle Display Name in your project.plist.
Bundle display name : ${PRODUCT_NAME}
should be changed to
Bundle display name : MySuperApp
This changes the label of the icon in iOS without actually changing the app identifiers.
If you just change the bundle display name, you won't need to set up a new app id and provisioning profiles.
Making the product name change:
Double click the name right under "Targets" and modify the target name to whatever you want.
Checking if the change has been made:
Click on "Target" and on the right hand side search for "Product Name" under "Build Settings". The displayed value of the product name should reflect your change. If not, double click on that name to make sure it's being set to $(TARGET_NAME).
Select Project
Select Target and single click to edit and rename and you're done
You can see the product name gets changed
Here the snap for these 3 steps
Edited:
I've noticed the similar answer with image attachment by youshunei after my post. So, I would add a bit more information here that I've tested it on Xcode 6.3.2 and it doesn't need any restart.
Edited:
When I renamed one of my Mac OS X app which contains comma in its name the same way. I got missing file (name trimmed up-to comma) in some pod linking library. So, I have to rename my app at Target -> Build Settings -> Product Name
To change the name of the app if it has been customized:
Project info -> Targets (click on app icon entry) -> Build Settings -> Product Name
In recent versions of XCode (I am on 4.3.2 currently), $(PRODUCT_NAME) is set to $(TARGET_NAME) which defaults to the name of the project directory (no don't change the directory name).
Solution: Click on the file navigator. Click on your blue project icon. Look for the TARGETS list (under the PROJECT list). Hover-click your target; then rename it to your product name.
Aside: If you are having code-signing problems, I found that deleting, revoking, and regenerating all certificates/keys, and profiles fixed my problem. I tried everything else first!
One thing that seemed to help when I went through this is in Xcode 4 is that it appeared to be necessary to delete all the schemes. Prior to this it seemed that although the app would be compiled under its new name, it'd be as the old name in the simulator. However, I did do other desperate measures like re-start xcode and delete the app out of the simulator folder so it's hard to be certain that deleting the schemes was the key.
The issue I was having was that I have multiple Info.plist files in my Xcode project. In order to ensure I had the right one which contains the Product Name, I moved the existing Info.plist temporarily to force Xcode to allow me to choose another one. Since Info.plist is not part of a target, but part of the Project configuration, this was the only way I could find to do this.

iPhone & iPad - two icons and two plists?

I have a product with two targets, one for iPhone and the other for iPad. I will build two separate applications, not universal.
As I will have to have two icon.png files for the application's icon, as they differ in size, as I see I will have to have two info.plist files. right?
I have created two copies of the info.plist file, named iphone-info.plist and ipad-info.plist. I have right clicked each one and assigned them to a specific target.
Now, when I compile I see this error:
Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'iPhone-Info.plist'.
If I remove the target assignment from both info files, the error vanishes.
here are the questions I have:
If I cannot set a target for info.plist, how each target knows which info.plist to use?
Is there another way to make each target have its own icon without using two plists?
thanks for any help.
If you get info on a target, click the "Build" tab, and type "plist" into the search box, you will see that the Info.plist file it expects to build that target with is listed in the Build settings. Change that to point to the file name of each plist file you want for each target.
Setting the target for each plist only adds it to the target build like any other file - to actually tell the app to use a particular plist file as "THE" plist file with relevant info, you also need to set it in the target settings.