关于ios:在Xcode 7.2中添加Font Awesome时发出

Issue while adding Font Awesome in Xcode 7.2

我正在尝试在我的iPhone应用程序中使用FontAwesome。我已经设置好所有东西。

但是每次我得到这个?(question)mark Image时。我确定我已经在我的项目以及Plist中正确添加了字体:

这是我的项目设置:

步骤1:

在我的项目中添加了字体真棒文件

enter image description here

第2步

在我的Mac中安装了"真棒字体"。

enter image description here

步骤:3

在我的pList文件中添加密钥。

enter image description here

第四步:

要确认,请检查情节提要中的字体列表:

enter image description here

步骤5:

以编程方式创建UILabel并设置如下字体:

1
2
3
4
5
6
 UILabel *lblFontAwesome = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 400)];
lblFontAwesome.center = self.view.center;
lblFontAwesome.font = [UIFont fontWithName:@"FontAwesome" size:35];
[lblFontAwesome setText:@"\\uf014"];

[self.view addSubview:lblFontAwesome];

步骤6:我还添加了一些类别文件。

enter image description here

步骤7:

这就是我得到的:

enter image description here

我在网上和SO上尝试了不同的解决方案。

但是它们似乎都不起作用。我总是得到这个?

请注意,当我尝试%C时,我会得到此图像:enter image description here
是的,并带有警告:
而且这也不是正确的图标。它只是显示未知图像。

enter image description here


I am sure that I have added the font Correctly In my Project and also in Plist

好吧,不显然,您没有正确添加它。

问题是,尽管字体文件在您的项目中,但没有将其复制到您的应用程序中。因此,它在正在运行的应用程序中不可用。

这里是解决此问题的方法。

在项目导航器(您的第一个屏幕截图)中,选择FontAwesome.ttf文件。现在,查看右侧的文件检查器。现在查看"目标成员资格"部分。确保已检查应用目标。