月度归档:2017年05月

resource fork, Finder information, or similar detritus not allowed

今天,我准备更新我的一个app,这个app很久以前上架的,当时还是iPhone 32位 CPU的时候,所以有必要更新一次。

然而,在编译过程中,我遇到了以下错误:

resource fork, Finder information, or similar detritus not allowed

经过一番搜索,找到了解决方案。

http://stackoverflow.com/questions/39652867/code-sign-error-in-macos-sierra-xcode-8-resource-fork-finder-information-or

https://developer.apple.com/library/content/qa/qa1940/_index.html

原来,MacOS的文件有三个fork,data fork, resource fork和Finder info。Data fork存储了文件的内容;resource fork保存了一些扩展信息,如什么应用创建了这个文件,又例如上次你打开这个txt文件的时候,正在显示的是第几行,等等; Finder Info则保存了文件所有者,创建者等信息。

从iOS 10和macOS Sierra开始,从安全考虑,app bundle中的文件将不能包含resource for和Finder info了。所以,我们必须去掉这两个信息,才能成功进行代码签名。具体如何去掉这两块信息,大家可以参考下面的说明。

40
Code signing fails with error 'resource fork, Finder information, or similar detritus not allowed'

Q:  When I build my app, code signing fails with the error "resource fork, Finder information, or similar detritus not allowed." What does this mean and what should I do about it?

A: This is a security hardening change that was introduced with iOS 10, macOS Sierra, watchOS 3, and tvOS 10.

Code signing no longer allows any file in an app bundle to have an extended attribute containing a resource fork or Finder info.

To see which files are causing this error, run this command in Terminal:

$ xattr -lr 

replacing  with the path to your actual app bundle.

Here's an example of this command in action:

$ xattr -lr Foo.app
/Applications/Foo.app: com.apple.FinderInfo:
00000000  00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00  |................|
You can also remove all extended attributes from your app bundle with the xattr command:

$ xattr -cr 

Note that browsing files within a bundle with Finder's Show Package Contents command can cause Finder info to be added to those files. Otherwise, audit your build process to see where the extended attributes are being added

更新到cocoapods 1.2.1了

今天准备更新到最新的cocoapods。我在mac上执行了遇到了一系列错误

$ sudo gem install cocoapods
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: cocoapods requires cocoapods-core (= 1.2.1), claide (< 2.0, >= 1.0.1), cocoapods-downloader (< 2.0, >= 1.1.3), cocoapods-trunk (< 2.0, >= 1.2.0), molinillo (~> 0.5.7), xcodeproj (< 2.0, >= 1.4.4), colored2 (~> 3.1), fourflusher (~> 2.0.1), ruby-macho (~> 1.1)

随后,我只能逐个执行gem install安装上述错误信息提供的依赖,结果,这样就安装成功了。似乎rubygems没有成功解决依赖,让我手动解决了????

$ sudo gem install cocoapods-core
Fetching: cocoapods-core-1.2.1.gem (100%)
Successfully installed cocoapods-core-1.2.1
Parsing documentation for cocoapods-core-1.2.1
Installing ri documentation for cocoapods-core-1.2.1
Done installing documentation for cocoapods-core after 1 seconds
1 gem installed


$ sudo gem install claide
Fetching: claide-1.0.1.gem (100%)
Successfully installed claide-1.0.1
Parsing documentation for claide-1.0.1
Installing ri documentation for claide-1.0.1
Done installing documentation for claide after 0 seconds
1 gem installed


$ sudo gem install cocoapods-downloader
Fetching: cocoapods-downloader-1.1.3.gem (100%)
Successfully installed cocoapods-downloader-1.1.3
Parsing documentation for cocoapods-downloader-1.1.3
Installing ri documentation for cocoapods-downloader-1.1.3
Done installing documentation for cocoapods-downloader after 0 seconds
1 gem installed

$ sudo gem install cocoapods-trunk
Fetching: cocoapods-trunk-1.2.0.gem (100%)
Successfully installed cocoapods-trunk-1.2.0
Parsing documentation for cocoapods-trunk-1.2.0
Installing ri documentation for cocoapods-trunk-1.2.0
Done installing documentation for cocoapods-trunk after 0 seconds
1 gem installed

$ sudo gem install molinillo
Fetching: molinillo-0.5.7.gem (100%)
Successfully installed molinillo-0.5.7
Parsing documentation for molinillo-0.5.7
Installing ri documentation for molinillo-0.5.7
Done installing documentation for molinillo after 0 seconds
1 gem installed

$ sudo gem install xcodeproj
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: xcodeproj requires colored2 (~> 3.1), nanaimo (~> 0.2.3)

$ sudo gem install colored2
Fetching: colored2-3.1.2.gem (100%)
Successfully installed colored2-3.1.2
Parsing documentation for colored2-3.1.2
Installing ri documentation for colored2-3.1.2
Done installing documentation for colored2 after 0 seconds
1 gem installed
mbp2:Caches jimmy$ sudo gem install nanaimo
Fetching: nanaimo-0.2.3.gem (100%)
Successfully installed nanaimo-0.2.3
Parsing documentation for nanaimo-0.2.3
Installing ri documentation for nanaimo-0.2.3
Done installing documentation for nanaimo after 0 seconds
1 gem installed

$ sudo gem install molinillo
Successfully installed molinillo-0.5.7
Parsing documentation for molinillo-0.5.7
Done installing documentation for molinillo after 0 seconds
1 gem installed

$ sudo gem install fourflusher
Fetching: fourflusher-2.0.1.gem (100%)
Successfully installed fourflusher-2.0.1
Parsing documentation for fourflusher-2.0.1
Installing ri documentation for fourflusher-2.0.1
Done installing documentation for fourflusher after 0 seconds
1 gem installed
mbp2:Caches jimmy$ sudo gem install ruby-macho
Fetching: ruby-macho-1.1.0.gem (100%)
Successfully installed ruby-macho-1.1.0
Parsing documentation for ruby-macho-1.1.0
Installing ri documentation for ruby-macho-1.1.0
Done installing documentation for ruby-macho after 0 seconds
1 gem installed