How to add .plist file to all targets in Xcode? - ios

Totally new to iOS but I'm currently trying to setup Google Analytics. I have followed the SDK documentation and everything went great until this step:
Add the configuration file to your project
Drag the GoogleService-Info.plist file you just downloaded into the root of your Xcode project and add it to all targets.
It doesn't say anything on HOW to add it to all targets. Being new to Xcode and iOS in general, I'm completely lost. Anyone with an answer for me?
Thanks!

Select the GoogleService-Info.plist in the project navigator (the file hierarchy on the left side of Xcode). Then, if it isn't open yet, open the utilities bar (click the top-right most button in Xcode). You will see a section 'Target Membership'. Check all the checkboxes to add the .plist to all targets.
In most cases it is enough to just add the file to your project.

Physically drag the GoogleService-Info.plist file from your download folder ( or wherever you saved it) to your main project directory as shown below. Once you do that, the "Targets" dialog should open automatically and you can choose all targets (...click on all the targets shown)

In Xcode 6
Follow the step sequence in this digram.
First select your target.
Select build settings tab.
Search for "info.plist file"
Edit the value for key "info.plist file" (Add the actual plist path in step 4)

If you select the plist in question and then go to the file inspector (press command+option+1 or select the first tab on the right panel), you can select on which targets you wish to include it:

Update for Xcode 12.3:
It should be selected automatically, but check anyway:
ce you drag the file to the root dir, select it and on the very right hand side you will see Target membership, make sure all the targets are selected.

It is important to note that GoogleService-Info.plist file should be added to xCode i.e. open your xCode and drag the file to Runner > Runner.
Then click on GoogleService-Info.plist. On the right side of he screen you can find Target Membership.

Related

How do I preserve or transfer the old project settings in an iOS app to a totally new project?

I have an iOS app written using storyboards and I and want to convert to SwiftUI with a totally new project. How do I preserve or transfer the project settings from the old project to the new project?
Here is possible way:
Backup current project folder (just in case, archive & store somewhere separately)
Duplicate project folder & rename it
From duplicated folder open .xcodeproj (non needed to rename)
In Project Navigator click project
4a. (keep project-wide-only settings). In target section select all targets and
click - button at bottom pane (or press Delete key on keyboard)
4b. (keep per-target settings). Select every target > Build Phases tab > Remove everything in every section.

Xcode target icon not displayed

Whilst trying the AFNetworking iOS example project I noticed that Xcode was displaying the target icon. Xcode does not do the same for my own projects/targets however.
AFNetworking iOS example project that shows the target icon:
A project that does not show the target icon:
The only difference I can see between both projects is that the AFNetworking iOS example target has an 'Icon files (iOS 5)' ('CFBundleIcons' raw key) dictionary within *-Info.plist. Surely this cant be the source of the problem though given that my example project is targeting iOS 7? Both targets do have an 'Icon files' ('CFBundleIconFiles' raw key) array within *-Info.plist.
Please could someone help to shed light on where Xcode is looking for the target icon?
I tried all the above and did not fixed the icon issue. I was using assets catalog for the project and X-Code version was 5.0.2.
Following steps fixed my issue:
Select the Project file from the navigator and select the target which you do not have the icons
Then select Build Phases and expand and Copy Bundle Resources
Add the *.xcassets file to the bundle resources (In my project the file name was Images.xcassets)
Clean and build the target.
To get the icon to appear you have to have the App Icon (Icon-72.png) in the root directory of your project.
If you've changed the App Icon name, you must change the correct properties (CFBundleIconFile, CFBundleIconFiles, and CFBundleIcons) in the Info.plist to the changed App Icon file name.
(This part doesn't matter, but I've found it works much better if you do.)
Fully qualify your info plist file in your target build settings with the following variable name: $(SRCROOT)/your_plist_file_name.plist (of course changing "your_plist_file_name" to the correct name)
I've also found you have to change your target's info plist to a different plist, then back to the correct plist file in order for the icon to show in the build settings. You'll also have to click away from the project file and then back in order for it to show in the list of targets.
I'm using Xcode 5, but this should work on Xcode 4 and above.
Good Luck.
Please flow the step
1)Click on the app icon arrow
2) drag the app icon 120*120 px
3) fisrt time click on the scheme then show the app icon or rest the simulator and again run
See this screenshot:
Here Blue are dimensions and red are icon names. Like 57-57 is actually 57-57.png. Put all these icons in the root of the project with .xcodeproj file. Add them into the project. Then set them all accordingly in Target > Project Name > General
Doing this will start showing every icon at its place in XCode automatically.
If using the Asset Catalog, select Images.xcassets and look in File Inspector. Check the target membership and make sure your target is selected.

XCode 4.6 - Can't click the Entitlements checkbox for iOS project

I have an iOS project that I have been working on for some time. I need to add entitlements. When I select my Target and check the "Entitlements" checkbox, it automatically un-checks it's self about 1 second later.
I have an .entitlements file in my project. I have removed it and recreated it. I have tried checking the "Entitlements" checkbox with and without the .entitlements file there.
I'm not sure what other details I need to provide to illustrate this issue, so if I have left anything out that may be important, please let me know.
I ended up figuring out the resolution.
What I had to do was remove and delete the entitlements file from my project, then go to both the Project's Build Settings tab and the Target Build Settings tab and remove all references to my .entitlements file. After this I closed XCode and re-opened it. At this point I was able to click the "Use Entitlements" checkbox.
I am sorry for not returning to this question earlier.

Accidentally deleted an iOS framework, is there anyway to download it

in iOS5.0, i accidentally deleted the messageUI.framework, now it does not exist in the Xcode library. Is there any way I can download just the framework or will I have to reinstall Xcode to get the framework back?
Thanks in advance for your help?
Above method will not work if your xCode's location is different. For that Open xCode click top project blue icon. Click Target-> build Phases -> Link Binary With Libraries
Now right or control click any existing framework and Show in Finder.
This way you will get all existing framework's default location. Now go to that location and add your deleted framework again.
Restart xcode then you will see your deleted framework as it was before.
Under your Project's Build Phases go to the "Link Binary With Libraries" section and press the + button.
In the search field type "message" and it should come back up. Select it and it'll be added.

Why can't I paste the child pane plist file into a project's Settings.bundle folder in Xcode 4.3.3?

I'm running Xcode 4.3.3 and I've been following a tutorial about app settings. Everything has been going great up until I get ready to add a plist for a child pane that I want to add.
I tried the suggestion in a very similar question (http://stackoverflow.com/q/6978203/1543207) and I'm following the same tutorial as specified within the linked post.
Open up finder, you can right click or two finger click Settings.bundle and choose "Show in Finder".
Right click Settings.bundle in the finder window, choose show package contents.
Copy the new plist file into this the settings.bundle next to the Root.plist
Delete the new plist from the main project.
I can copy the plist file but I can't paste the plist file created into settings.bundle.
Any help would be greatly appreciated.
I got it.In Xcode 4.3.2,
Right click the Project Name in the Project Navigator, and choose Show in Finder;
In Finder, right click the setting.bundle and choose Show Package Contents;
Copy the new .plist to setting.bundle;
Back to XCode, open the setting.bundle, wilfully add one item under the Preference Items, then expand it and modify the value of Type to Child Pane.I can't upload the image, so give the link of the blog.
I hope can help you.

Resources