关于 cocoaPods "Remove the build settings from the target"或target overrides the `OTHER_LDFLAGS` 报错解决

最近mac 整体环境升级了下:pod版本1.4.0 , ruby也升级到2.5.1 , brew 版本1.5.14, gem版本2.7.6;然后在使用cocoapods就出了各种错误,

先是出现 Podfilew文件问题报错,如下:

cannot load such file -- cfpropertylist

终端显示:


 ### Command

```

/Users/songyaqing/.rvm/rubies/ruby-2.5.1/bin/pod install

```

### Report

* What did you do?

* What did you expect to happen?

* What happened instead?

### Stack

```

   CocoaPods : 1.4.0

        Ruby : ruby 2.5.1p0 (2015-12-25 revision 53290) [x86_64-darwin15]

    RubyGems : 2.6.8

        Host : Mac OS X 10.11.6 (15G31)

       Xcode : 7.2 (7C68)

         Git : git version 2.11.0

Ruby lib dir : /Users/songyaqing/.rvm/rubies/ruby-2.5.1/lib

Repositories : master - https://github.com/CocoaPods/Specs.git @ 10b14b58c1c8f78ae604df50fb61fe6fbcc58435

```

### Plugins

```

cocoapods-deintegrate : 1.0.1

cocoapods-plugins     : 1.0.0

cocoapods-search      : 1.0.0

cocoapods-stats       : 1.0.0

cocoapods-trunk       : 1.1.2

cocoapods-try         : 1.1.0

```

### Podfile

```ruby

source 'https://github.com/CocoaPods/Specs.git'

inhibit_all_warnings!

project '../HYCustomCenter.xcodeproj'

target 'HYCustomCenter' do

pod 'AFNetworking', '~> 3.0.4'

pod 'IQKeyboardManager'

pod 'SDWebImage'

pod 'Masonry', '~> 0.6.2'

pod 'MJRefresh', '~> 2.4.9'

pod 'FMDB'

end

end 

end

```

### Error

```

ArgumentError - invalid byte sequence in UTF-8

/Users/songyaqing/.rvm/gems/[email protected]/gems/cocoapods-core-1.4.0/lib/cocoapods-core/podfile.rb:278:in `tr!'

/Users/songyaqing/.rvm/gems/[email protected]/gems/cocoapods-core-1.4.0/lib/cocoapods-core/podfile.rb:278:in `from_ruby'

/Users/songyaqing/.rvm/gems/[email protected]/gems/cocoapods-core-1.4.0/lib/cocoapods-core/podfile.rb:252:in `from_file'

/Users/songyaqing/.rvm/gems/[email protected]/gems/cocoapods-1.4.0/lib/cocoapods/config.rb:191:in `podfile'

/Users/songyaqing/.rvm/gems/[email protected]/gems/cocoapods-1.4.0/lib/cocoapods/command.rb:123:in `verify_podfile_exists!'

/Users/songyaqing/.rvm/gems/[email protected]/gems/cocoapods-1.4.0/lib/cocoapods/command/install.rb:33:in `run'

/Users/songyaqing/.rvm/gems/[email protected]/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'

/Users/songyaqing/.rvm/gems/[email protected]/gems/cocoapods-1.4.0/lib/cocoapods/command.rb:50:in `run'

/Users/songyaqing/.rvm/gems/[email protected]/gems/cocoapods-1.4.0/bin/pod:55:in `<top (required)>'

/Users/songyaqing/.rvm/rubies/ruby-2.5.1/bin/pod:22:in `load'

/Users/songyaqing/.rvm/rubies/ruby-2.5.1/bin/pod:22:in `<main>'

/Users/songyaqing/.rvm/gems/[email protected]/bin/ruby_executable_hooks:15:in `eval'

/Users/songyaqing/.rvm/gems/[email protected]/bin/ruby_executable_hooks:15:in `<main>'

```

――― 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+UTF-8&type=Issues

If none exists, create a ticket, with the template displayed above, on:

https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket:

https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...

- Pod install fails on invalid byte sequence while having LANG=en_US.UTF-8 in profile

   https://github.com/CocoaPods/CocoaPods/issues/5780 [closed] [5 comments]

   3 Apr 2014

- Pod install & pod --verbose getting failed

   https://github.com/CocoaPods/CocoaPods/issues/6297 [open] [2 comments]

   a week ago

- ArgumentError - invalid byte sequence in US-ASCII

   https://github.com/CocoaPods/CocoaPods/issues/5348 [closed] [3 comments]

and 13 more at:

https://github.com/cocoapods/cocoapods/search?q=invalid%20byte%20sequence%20in%20UTF-8&type=Issues&utf8=

问题所在是:Podfile文件编码格式被修改过,使用文本编辑器打开过, 破坏了编码结构。

解决办法是重新创建一个Podfile 文件, 不过内容别直接复制过来, 你可以 先把原来的Podfile”内容拷贝到备忘录或者Xcode中,然后再用于新文件,把 之前的Podfile.lock、 project.xcworkspace文件、 Pods文件夹删除下, 重新pod install下可以了,

如果想要预览Podfile文件可以使用Xcode打开, 不知道是否OSX 10.13 系统原因, 记得以前文本编辑器打开没问题, 升级了最新版, 就出现问题了。
2.
关于 cocoaPods "Remove the build settings from the target"或target overrides the `OTHER_LDFLAGS` 报错解决

于此同时项目内出现如下报错:

diff: /../Podfile.lock: No such file or directory

diff: /Manifest.lock: No such file or directory error: The sandbox is not in sync with the Podfile.lock.

Run 'pod install' or update your CocoaPods installation

解决办法;

1> 是打开工程所在文件夹,找到.xcodeproj的文件,然后显示包内容,找到project.pbxproj文件,如下:

关于 cocoaPods "Remove the build settings from the target"或target overrides the `OTHER_LDFLAGS` 报错解决

2> 用文本编辑器打开,然后查找ENABLE_BITCODE这个东西,把有关这个东西的地方都删掉,如下图:

关于 cocoaPods "Remove the build settings from the target"或target overrides the `OTHER_LDFLAGS` 报错解决

3> 用文本编辑器打开,然后查找`OTHER_LDFLAGS`这个东西,把有关这个东西的地方都删掉(应该有四处),如下图:

关于 cocoaPods "Remove the build settings from the target"或target overrides the `OTHER_LDFLAGS` 报错解决

4> 把以前的文件删掉,删除以后重新 pod install  一下 导入成功。

关于 cocoaPods "Remove the build settings from the target"或target overrides the `OTHER_LDFLAGS` 报错解决

如有问题,请指出!共勉!

联系邮箱:[email protected]