Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't change target membership visibility in Xcode 4.5

Tags:

I currently try to exclude my In-App Purchase logic in an App of mine to make it reusable in other Apps of mine or even put it on a public git repository for others to use. For this purpose I follow this guide of creating a framework in XCode.

But in step 2 I have to set the Target Membership of my .h file to public. The problem is, that in my Xcode (v 4.5) I can't see any visibility when the .h file is clicked (and also not when I click other files like .m ones). It looks like that:

enter image description here

What am I doing wrong there?

like image 519
CGee Avatar asked Nov 26 '12 18:11

CGee


People also ask

How do I change my target membership Xcode?

You can access Target Membership by selecting file and opening the right menu in Xcode (the menu is called Inspectors ). Then, in File Inspector at the bottom of the menu, find Target Membership . It's very important to check all files in your project because without this you won't be able to build a new app target.

Where is target settings in Xcode?

Choose the project in the Project Navigator on the left. Select the Configurations target from the Targets section and click the Build Settings tab at the top. The Build Settings tab shows the build settings for the Configurations target. It's possible to expand this list with build settings that you define.

How do I add a target to my Xcode project?

You can also add new apps, system extensions, test suites, and other types of targets to your project. To add a new target: Choose File > New > Target. Select the platform for the new target.

What is the difference between project and target in Xcode?

An project is a repository for all the files, resources, and information required to build one or more software products. A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace.


2 Answers

I came across this same problem and found your question an hour after it was posted but here is what I have found. In Xcode 4.4 the ability to change the target membership, and visibility, for header files was removed so this tutorial will not work as written.

Instead of changing the target membership visibility you can add a "Copy Headers" build phase to the target you made in step 1 (Serenity in the example). This will have 3 sections for Public, Private, and Project headers. Just click the plus at the bottom and the headers you want to be public to this step. By default they are put in the Project section but you can click and drag them to the Public section.

The rest of the tutorial should work fine from there.

Edit: Just noticed that in my own project, after adding the copy headers build step, that the target membership can be selected for header files so the tutorial works as written. Though it seems to act a little strange with my framework header. In any case, changing the visibility in the build phase is reflected under target membership and vice versa

like image 153
jupham Avatar answered Oct 19 '22 23:10

jupham


Build Phases -> Add Build Phase -> Copy Bundle Resources (in case you don't have it) Then drag and drop your file there... Good luck ;)

like image 43
Mazen Kasser Avatar answered Oct 20 '22 00:10

Mazen Kasser