CocoaPods使用中的invalid byte sequence in US-ASCII错误

当iOS的应用工程逐渐膨胀,或者说迅速成长,依赖于第三方的开源库或者自己封装的一些模块间的依赖关系也就会逐渐丰富和复杂起来。在Java中有maven来做依赖的管理,在C语言开发中,也有Makefile这样的工具来帮助编译,而在iOS平台的开发当中,CocoaPods正逐渐成为了主流的依赖管理工具,本文先不对CocoaPods的详细使用和实现做分析,只是本人使用过程中出现的一个小问题记录一下,整理一下。

这个问题其他论坛也有结果,不过不想忘记的时候总去依赖搜索引擎查。

CocoaPods在写好Podfile后,执行podfile。有时在分析依赖结束后,就要成功了,却在最后出现了如下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
### Error
 
```
ArgumentError - invalid byte sequence in US-ASCII
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/installer/pod_source_installer.rb:257:in `glob'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/installer/pod_source_installer.rb:257:in `glob'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/installer/pod_source_installer.rb:257:in `clean_paths'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/installer/pod_source_installer.rb:157:in `clean_installation'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/installer/pod_source_installer.rb:82:in `clean!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/installer.rb:278:in `block in clean_pod_sources'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/installer.rb:277:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/installer.rb:277:in `clean_pod_sources'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/installer.rb:107:in `block in download_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/user_interface.rb:52:in `section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/installer.rb:103:in `download_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/installer.rb:89:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/command/project.rb:38:in `run_install_with_update'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/command/project.rb:68:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-0.5.0/lib/claide/command.rb:277:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/lib/cocoapods/command.rb:51:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.31.1/bin/pod:33:in `'
/usr/bin/pod:23:in `load'
/usr/bin/pod:23:in `'
```
 
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
 
[!] Oh no, an error occurred.
 
Search for existing github issues similar to yours:
 
https://github.com/CocoaPods/CocoaPods/search?q=invalid+byte+sequence+in+US-ASCII&type=Issues
 
If none exists, create a ticket, with the template displayed above, on:
 
https://github.com/CocoaPods/CocoaPods/issues/new
 
Don't forget to anonymize any private data!

从上面可以看得出来CocoaPods是Ruby做的,不过没有这个错误经验的人只从“非法的ASCII字节顺序”提示完全不知道解决方案可能是什么。

其实,方法很简单,就是修改终端的语言、地区等国际化相关环境变量,只要重新导出这3个变量即可。

1
2
3
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

这样做当前终端就没有问题了,必要情况可以直接将其放到profile中,这样每次终端打开就自动配置好了。

关于CocoaPods的具体用法和分析,后面有空再详细整理。


转载:http://www.molotang.com/articles/1590.html

你可能感兴趣的:(CocoaPods使用中的invalid byte sequence in US-ASCII错误)