This error pops when I try to build my project to MacOS with Create Xcode Project.
I’ve been wracking my brain trying to fix this issue. I’ve followed a bunch of suggestions on Stack Overflow and the Apple Developer forums. Nothing seems to work.
The only thing that I can guess is the problem is with Unity Purchasing plugin and it not being signed.
Does anyone know how I can possibly fix this issue?
Can you post the full build log?
Sure…
CodeSign /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug/Fish\ Heads.app
cd "/Users/zbellace/Documents/Development/Unity/Builds/Fish Heads/MacOS"
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
Signing Identity: XXXXXXXXXXXXXX
Provisioning Profile: XXXXXXXXXXXX
(XXXXXXXXXXXXXXXXXXX)
/usr/bin/codesign --force --sign FA717CB20BEEB1CE2DD7D7184A21908BD5C5F331 --entitlements /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Intermediates.noindex/MacOS.build/Debug/Fish\ Heads.build/Fish\ Heads.app.xcent --timestamp=none /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug/Fish\ Heads.app
/Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug/Fish Heads.app: replacing existing signature
/Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug/Fish Heads.app: code object is not signed at all
In subcomponent: /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug/Fish Heads.app/Contents/PlugIns/unitypurchasing.bundle
Command /usr/bin/codesign failed with exit code 1
Sorry I posted the error… Let me find the actual build log.
Showing Recent Issues
Prepare build
warning: The Legacy Build System will be removed in a future release. You can configure the selected build system and this deprecation message in File > Project Settings.
Build target Fish Heads of project MacOS with configuration Debug
Ld /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Intermediates.noindex/MacOS.build/Debug/Fish\ Heads.build/Objects-normal/x86_64/Fish\ Heads normal x86_64
cd "/Users/zbellace/Documents/Development/Unity/Builds/Fish Heads/MacOS"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target x86_64-apple-macos10.11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -L/Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug -F/Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug -filelist /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Intermediates.noindex/MacOS.build/Debug/Fish\ Heads.build/Objects-normal/x86_64/Fish\ Heads.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -object_path_lto -Xlinker /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Intermediates.noindex/MacOS.build/Debug/Fish\ Heads.build/Objects-normal/x86_64/Fish\ Heads_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -stdlib=libc++ -framework StoreKit /Users/zbellace/Documents/Development/Unity/Builds/Fish\ Heads/MacOS/Fish\ Heads/Frameworks/UnityPlayer.dylib -framework GameKit -Xlinker -dependency_info -Xlinker /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Intermediates.noindex/MacOS.build/Debug/Fish\ Heads.build/Objects-normal/x86_64/Fish\ Heads_dependency_info.dat -o /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Intermediates.noindex/MacOS.build/Debug/Fish\ Heads.build/Objects-normal/x86_64/Fish\ Heads
ld: warning: dylib (/Users/zbellace/Documents/Development/Unity/Builds/Fish Heads/MacOS/Fish Heads/Frameworks/UnityPlayer.dylib) was built for newer macOS version (10.13) than being linked (10.11)
CodeSign /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug/Fish\ Heads.app
cd "/Users/zbellace/Documents/Development/Unity/Builds/Fish Heads/MacOS"
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
Signing Identity: XXXXXXXXXXXXXXXXXXXXXXXX
Provisioning Profile: XXXXXXXXXXXXXXXXXXXXXXXXX
(XXXXXXXXXXXXXXXXXXXXXX)
/usr/bin/codesign --force --sign FA717CB20BEEB1CE2DD7D7184A21908BD5C5F331 --entitlements /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Intermediates.noindex/MacOS.build/Debug/Fish\ Heads.build/Fish\ Heads.app.xcent --timestamp=none /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug/Fish\ Heads.app
/Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug/Fish Heads.app: replacing existing signature
/Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug/Fish Heads.app: code object is not signed at all
In subcomponent: /Users/zbellace/Library/Developer/Xcode/DerivedData/MacOS-bpkdrnrzciyycibcbnnunhcfurhl/Build/Products/Debug/Fish Heads.app/Contents/PlugIns/unitypurchasing.bundle
Command /usr/bin/codesign failed with exit code 1
Build failed 1/22/21, 3:49 PM 3.4 seconds
Looks like the signing step is missing “–deep” argument and since unitypurchasing.bundle isn’t signed, it fails. You have three options:
- Update to the latest unitypuchasing version, since the signing issue has been fixed;
- Fixup the Xcode project to add the “–deep” argument;
- Codesign unitypurchasing.bundle manually before building Unity project or before building the Xcode project.
Build still fails codesign.
What’s really strange is that despite updating to 2.2.6 for IAP, after a restart of Unity I’m back down to 2.2.2.
What’s going on here?
Where does one “add the --deep argument”?
I can’t find anything in that stack overflow question that has any parity to what I’m looking at in my xcode project.
Are you not able to find “Other Code Signing Flags” to add the --deep parameter to?
No, not even when I type it into the search field.
Okay, it now succeeds the build but then fails during run time…
Is this on 2020.2.2f1? Can you share the build settings you used to build the game? I cannot reproduce this.
2019.4.17f1 but I just downloaded 2020.2.2f1 on an Apple Silicon device so I’ll see what I can get from there too. Just a heads up though, I was getting the codesign error over there with 2020.2.1f a couple of days ago as well.
Stay tuned…
Okay it SEEMS to be building and launching but NOW I’m getting an authentication request that fails despite a successful authentication. 
Huh wha?! So it launches a few times and then stops working with that error message and you cannot launch it anymore afterwards?