如何使用CocoaPods将GitHub的Mantle添加到Xcode

时间:2023-01-27 10:48:54

I have added GitHub's Mantle project to a iOS 6 project using CocoaPods:

我已经使用CocoaPods将GitHub的Mantle项目添加到iOS 6项目中:

$ pod search Mantle
$ vim Podfile // here I added pod 'Mantle'
$ pod install // this installs Mantle 1.0 

Then I have added the ($inherited) variable to the Header Search Paths of project's 'Build Settings' section, before my custom search paths. When importing the Mantle header file Xcode complains with

然后我在自定义搜索路径之前将($ inherited)变量添加到项目的“Build Settings”部分的Header Search Paths中。当导入Mantle头文件Xcode抱怨时

#import "Mantle.h" // => 'Mantle/MTLJSONAdapter.h' file not found

Am I missing some step? I have other pods installed as well (AFNetworking and SSKeychain) but only Mantle is giving me issues.

我错过了一步吗?我也安装了其他吊舱(AFNetworking和SSKeychain),但只有Mantle给我提出了问题。

I have also added SSToolkit but following the instructions on its 'Getting started', i.e. not using CocoaPods.

我还添加了SSToolkit,但遵循其“入门”的说明,即不使用CocoaPods。

3 个解决方案

#1


5  

Since the problem seemed to be related with the Xcode project/workspace configuration I tried all kind of 'cleaning' solutions:

由于问题似乎与Xcode项目/工作区配置有关,我尝试了各种“清理”解决方案:

  1. Delete the Pods directory, the Podfile.lock file and install everything from scratch.
  2. 删除Pods目录,Podfile.lock文件并从头开始安装。
  3. Delete the MyProject.xcworkspace directory and repeat step 1
  4. 删除MyProject.xcworkspace目录并重复步骤1
  5. Enter MyProject.xcodeproj, delete project.xcworkspace and xcuserdata directories and repeat step 1.
  6. 输入MyProject.xcodeproj,删除project.xcworkspace和xcuserdata目录,然后重复步骤1。
  7. Go to the global Xcode directory (/Users/my_user/Library/Developer/Xcode), remove everything related to the project, specially the DerivedData subdirectory, and repeat step 1.
  8. 转到全局Xcode目录(/ Users / my_user / Library / Developer / Xcode),删除与项目相关的所有内容,特别是DerivedData子目录,然后重复步骤1。

The final step seems to be the final solution, though I cannot tell which file/folder removal did the trick.

最后一步似乎是最终的解决方案,虽然我无法分辨哪个文件/文件夹删除的伎俩。

#2


1  

Have you added Mantle to your Podfile? You mention running pod install Mantle which doesn't/shouldn't do anything but show an error. ([!] Unrecognized argument:Mantle'`)

你有没有将Mantle添加到你的Podfile?你提到运行pod install Mantle,它不会/不应该做任何事情,但显示错误。 ([!]无法识别的论点:Mantle'。)

After you add Mantle to your Podfile and run pod install you should be able to link Mantle.h directly and there will be a few directories in your xcworkspace and the Pods project. After this you can use #import "Mantle.h" no issues.

将Mantle添加到Podfile并运行pod安装后,您应该可以直接链接Mantle.h,并且xcworkspace和Pods项目中会有一些目录。在此之后你可以使用#import“Mantle.h”没有问题。

如何使用CocoaPods将GitHub的Mantle添加到Xcode

#3


0  

I had the same problem, but the problem appears to simply be that my Mantle pod was too old. Changed version to '2.0.5' and pod updated, things work fine.

我有同样的问题,但问题似乎只是我的Mantle吊舱太旧了。将版本更改为“2.0.5”并更新了pod,工作正常。

#1


5  

Since the problem seemed to be related with the Xcode project/workspace configuration I tried all kind of 'cleaning' solutions:

由于问题似乎与Xcode项目/工作区配置有关,我尝试了各种“清理”解决方案:

  1. Delete the Pods directory, the Podfile.lock file and install everything from scratch.
  2. 删除Pods目录,Podfile.lock文件并从头开始安装。
  3. Delete the MyProject.xcworkspace directory and repeat step 1
  4. 删除MyProject.xcworkspace目录并重复步骤1
  5. Enter MyProject.xcodeproj, delete project.xcworkspace and xcuserdata directories and repeat step 1.
  6. 输入MyProject.xcodeproj,删除project.xcworkspace和xcuserdata目录,然后重复步骤1。
  7. Go to the global Xcode directory (/Users/my_user/Library/Developer/Xcode), remove everything related to the project, specially the DerivedData subdirectory, and repeat step 1.
  8. 转到全局Xcode目录(/ Users / my_user / Library / Developer / Xcode),删除与项目相关的所有内容,特别是DerivedData子目录,然后重复步骤1。

The final step seems to be the final solution, though I cannot tell which file/folder removal did the trick.

最后一步似乎是最终的解决方案,虽然我无法分辨哪个文件/文件夹删除的伎俩。

#2


1  

Have you added Mantle to your Podfile? You mention running pod install Mantle which doesn't/shouldn't do anything but show an error. ([!] Unrecognized argument:Mantle'`)

你有没有将Mantle添加到你的Podfile?你提到运行pod install Mantle,它不会/不应该做任何事情,但显示错误。 ([!]无法识别的论点:Mantle'。)

After you add Mantle to your Podfile and run pod install you should be able to link Mantle.h directly and there will be a few directories in your xcworkspace and the Pods project. After this you can use #import "Mantle.h" no issues.

将Mantle添加到Podfile并运行pod安装后,您应该可以直接链接Mantle.h,并且xcworkspace和Pods项目中会有一些目录。在此之后你可以使用#import“Mantle.h”没有问题。

如何使用CocoaPods将GitHub的Mantle添加到Xcode

#3


0  

I had the same problem, but the problem appears to simply be that my Mantle pod was too old. Changed version to '2.0.5' and pod updated, things work fine.

我有同样的问题,但问题似乎只是我的Mantle吊舱太旧了。将版本更改为“2.0.5”并更新了pod,工作正常。