Code Sign Error in macOS High Sierra Xcode - resou

2019-01-01 12:02发布

Already tried : Code Sign Error on macOS Sierra, Xcode 8

Please see image showing error enter image description here

CodeSign /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super\ Flow\ Flip.app
    cd "/Volumes/Development/Project/Top Best Games/19. Lets Flow/35/let's FLOW - source/proj.ios_mac"
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Signing Identity:     "iPhone Distribution: New Free Games (2CHN583K4J)"
Provisioning Profile: "Super Flow Flipp AppStore"
                      (c6c30d2a-1025-4a23-8d12-1863ff684a05)

    /usr/bin/codesign --force --sign E48B98966150110E55EAA9B149F731901A41B37F --entitlements /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Intermediates/Flow.build/Debug-iphoneos/Super\ Flow\ Flip.build/Super\ Flow\ Flip.app.xcent --timestamp=none /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super\ Flow\ Flip.app

/Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super Flow Flip.app: resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1

In Code Sign section its allowing me to select profile and certificate...but still giving error. enter image description here

enter image description here

How to fix this problem ?

21条回答
临风纵饮
2楼-- · 2019-01-01 12:31

If the xattr commands doesn't the trick this may be due to an XCode 9 bug: let's try to remove and re-add the resource folder (it was a .xcassets in my case) containing the affected files from Xcode. (you should understand which are the affected files previous through the xattr -lr command)

查看更多
看风景的人
3楼-- · 2019-01-01 12:32

There is official Apple answer for this issue in Technical Q&A QA1940.

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 <path_to_app_bundle>

You can also remove all extended attributes from your app bundle with the xattr command: xattr -cr <path_to_app_bundle>

<path_to_app_bundle> can be replaced with directory of your Xcode project. For example ~/Development/MyProject

查看更多
查无此人
4楼-- · 2019-01-01 12:35

The easiest way to handle attributes on your source files is to have Xcode clear up the archive before it runs codesign. To do this:

  1. Select your target in XCode
  2. Select the Build Phases tab
  3. Press the + symbol
  4. Select New Run Script Phase
  5. Enter the following for the script:

    xattr -cr ~/Library/Developer/Xcode/DerivedData || echo Clear

Now when you build your target it will clear out any attributes that would have broken codesign. By clearing out at this stage you don't have to alter your source code / project directory.

The "|| echo Clear" part of the script ensures that the project build continues even if xattr errors.

This method is good if you use programs such as DropBox on your code repository that add the attributes, as it doesn't change your source project, only the built archive.

You may need to change the path to match your DerivedData directory - this path will be shown next to the codesign error.

xattr codesign xcode fix

查看更多
君临天下
5楼-- · 2019-01-01 12:35

I found that if I add color tag on the folder under DerivedData, it will give the above error when debug on device.

Remove the color Tag fix this error for me.

enter image description here

查看更多
看风景的人
6楼-- · 2019-01-01 12:36

My problem is every change I make in the code and execute again the error reappears. Then I find a solution to execute the command automatically every compilation/execution of code.

Thanks to @rich-able I discovered "Run Script". Then I put the command "xattr -cr ." in the field.

XCODE Solution

查看更多
骚的不知所云
7楼-- · 2019-01-01 12:36

The simplest fix may be if you are using git. Try:

$ git stash
$ git stash pop

Git does not store file metadata, the above will strip it all away.

查看更多
登录 后发表回答