本文介绍了无法在Xcode 4.5中更改目标会员的可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前尝试在我的应用程序中排除我的应用程序内购买逻辑,以使其可以在我的其他应用程序中重用,甚至可以将其放置在公共git存储库供其他人使用。为此,我遵循在XCode中创建框架。



但是在我必须将我的.h文件的目标成员设置为公开。问题是,在我的Xcode(v 4.5)中,单击.h文件时我看不到任何可见性(也没有单击其他文件,如.m文件)。它看起来像这样:





我在那里做错了什么?

解决方案

这个相同的问题,并发现你的问题一小时后,但这里是我发现的。在Xcode 4.4中,更改头文件的目标成员资格和可见性的能力已被删除,因此本教程不会按照书面方式工作。



不改变目标会员可见度您可以将复制标题构建阶段添加到您在步骤1中创建的目标(示例中的宁静)。这将有3个部分的公共,私人和项目标题。只需点击底部的加号和希望公开的标题即可。默认情况下,它们放在Project部分,但你可以点击并拖动它们到Public部分。



本教程的其余部分应该可以正常工作。



编辑:刚刚注意到,在我自己的项目中,添加副本头构建步骤后,可以为头文件选择目标成员资格,以便该教程可以像写入一样工作。虽然它似乎与我的框架标题有点奇怪。无论如何,在构建阶段更改可见性会反映到目标成员身上,反之亦然。

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:

What am I doing wrong there?

解决方案

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

这篇关于无法在Xcode 4.5中更改目标会员的可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 06:02