Using the CocoaPods Project
-
If something doesn’t seem to work, first of all ensure that you are not completely overriding any options set from the Pods.xcconfig file in your project’s build settings. To add values to options from your project’s build settings, prepend the value list with $(inherited).
-
If Xcode can’t find the headers of the dependencies:
2.1. Check if the pod header files are correctly symlinked in Pods/Headers and you are not overriding the HEADER_SEARCH_PATHS (see #1).
2.2 Make sure your project is using the Pods.xcconfig. To check this select your project file, then select it in the second pane again and open the Info section in the third pane. Under configurations you should select Pods.xcconfig for each configurations requiring your installed pods.
2.3 If Xcode still can’t find them, as a last resort you can prepend your imports, e.g. #import "Pods/SSZipArchive.h".
-
If you're getting errors about unrecognised C compiler command line options, e.g. cc1obj: error: unrecognised command line option "-Wno-sign-conversion":
3.1 Make sure your project build settings are configured to use "Apple LLVM compiler" (clang)
3.2 Are you setting the CC, CPP or CXX environment variable, e.g. in your ~/.profile? This may interfere with the Xcode build process. Remove the environment variable from your ~/.profile. -
If Xcode complains when linking, e.g. Library not found for -lPods, it doesn't detect the implicit dependencies:
1.1 Go to Product > Edit Scheme
1.2 Click on Build
1.3 Add the Pods static library, and make sure it's at the top of the list
1.4 Clean and build again
1.5 If that doesn't work, verify that the source for the spec you are trying to include has been pulled from GitHub. Do this by looking in <Project Dir>/Pods/<Name of spec you are trying to include>. If it is empty (it should not be), verify that the ~/.cocoapods/master/<spec>/<spec>.podspec has the correct git hub url in it.
1.6 If still doesn't work, check your Xcode build locations settings. Go to Preferences -> Locations -> Derived Data -> Advanced and set build location to "Relative to Workspace".
If you tried to submit app to App Store, and found that "Product" > "Archive" produce nothing in "Organizer":
In Xcode "Build Settings", find "Skip Install". Set the value for "Release" to "NO" on your application target. Build again and it should work.
不同的Xcode版本可能有各种各样的问题。请求帮助,告诉我们你正在使用的版本。
我可以使用静态库来解决“重复符号”错误吗?
This usually occurs when you’re using a closed-source third-party library that includes a common dependency of your application. One brute-force workaround is to remove the dependency from the static library, as described here
However, in general, the vendor should really prefix any dependencies it includes, so you don’t need to deal with it. When this happens, please contact the vendor and ask them to fix it on their side and use the above method as a temporary workaround.
我在运行pod命令时得到权限错误
I'm getting permission errors while running pod commands
在CocoaPods 0.32.0中,我们已经去掉了将pod命令作为根来运行的能力,以防止在混合和匹配以root身份运行时,CocoaPods进入不一致的状态。
如果您在某一阶段运行了CocoaPods作为根,那么在执行某些操作时,您可能会开始获得权限,而不允许出现错误。当您遇到权限错误时,您可能需要删除作为根运行的旧文件,比如缓存数据。您可以使用以下命令来完成此操作。
As of CocoaPods 0.32.0 we have removed the ability to run the pod commands as root to prevent CocoaPods from getting into an inconsistent state when you mix and match running as root.
If you have ran CocoaPods as root at one stage you may start getting permission denied errors when performing certain operations. When you come across permission errors you may need to delete old files which run as root such as the cache data. You can do this with the following commands.
$ sudo rm -fr ~/Library/Caches/CocoaPods/
$ sudo rm -fr ~/.cocoapods/repos/master/
除了这些全局文件,还可能在任何地方都有一个pod目录。如果您仍然收到权限错误,您也应该删除这个目录,然后运行pod安装。
Alongside those global files, there may also be a Pods directory in any place you have a Podfile. If you still receive permission errors you should delete this directory too, and afterwards run pod install.
$ sudo rm -fr Pods/
网友评论