Setting up Xcode for CocoaPods plugin

放肆的年华 提交于 2019-12-06 04:11:59

问题


I am trying to setup terminal/Xcode to work correctly for the Xcode CocoaPods Plugin.

When I run integrate cocoapods option from the plugin I get a message:

[33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding. See https://github.com/CocoaPods/guides.cocoapods.org/issues/26 for possible solutions.[0m

I have searched for the answer to this but I cannot find it. The resolution appears to be to complete the following:

export LC_ALL="en_US.UTF-8"

I am not sure how to complete this? I have run this in terminal and then when I output the locale I see the following:

LANG="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_CTYPE="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_ALL="en_GB.UTF-8"

However, when I quit/reopen Terminal the LC_ALL is blank again. Is there something I should run after this?

EDIT - I have seen this link http://perlgeek.de/en/article/set-up-a-clean-utf8-environment but still unable to complete the install of the locale, not sure how.


回答1:


So there's two ways to approach this, which is reflected in the two types of answers here.

One is to make a permanent change to your environment by changing your shell configuration (e.g. .bashrc or locale defaults). So running this app on another machine will run into similar errors.

The other way is to change this setting as part of the build process of your app, so it will run successfully on any machine - but every time you create a new app using the Cocoapods plugin you'll need to add this script.

My preference is for the latter, so here's how to do that:

Edit your current build scheme - cmd-option-R

Expand Build, and select Pre-actions

Add a New Run Script Action

Then for your script, just add:

export LC_ALL="en_US.UTF-8"

This worked for me. It should look something like this:




回答2:


Are you typing this manually or running it in a shell .rc file?

Depending how CocoaPods is running will indicate where to put these defines in the proper shell startup file to make sure they occur on each shell session.

If you don't own a copy of O'Reilly's Unix in a Nutshell, I strongly recommend it.

I put a series of aliases and defines in my .bashrc and .bash_login which makes sure that terminal based and non-terminal based bash sessions pick up additional defines and aliases.

For information on bash dot files you can look at StackOverflow's discussion of this. As there is a very good answer on it.

In general you can simply put the commands into these files. A standard test to see how the encompassing app (Pods in this case) may be calling into the shell is to simply put commands into each file like:

echo "running .bashrc"

Be careful of line endings (I always add extra returns at the end) and spacing. Shell is a very different beast from Objective-C




回答3:


Hit cmd-option-R and do something similar to what is in the screenshot:



来源:https://stackoverflow.com/questions/20036036/setting-up-xcode-for-cocoapods-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!