I am developing a crossplatform app targetting both Android and iOS devices using Xamarin.Forms (4.1) with Visual Studio (2019) running on a Windows machine (10). Of course I have a Mac (Mac Mini) so that I am able to build binaries for iOS devices. Until recently, I was using a free provisioning profile, but switched to a paid Apple developer account when I started implementing Push Notifications.
When working on the iOS project, I face the above error several times a day.
You can imagine that this is very annoying.
This is is MSBuildTask running for CodeSigning:
<CodesignVerify SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" ToolExe="$(CodesignExe)" ToolPath="$(CodesignPath)" CodesignAllocate="$(_CodesignAllocate)" Resource="$(AppBundleDir)" > </CodesignVerify>
This is the binary that is executed on my Mac including its parameters:
/usr/bin/codesign --verify -vvvv -R='anchor apple generic and certificate 1[field.1.2.840.1136184.108.40.206.1] exists and (certificate leaf[field.1.2.840.1136220.127.116.11.2] exists or certificate leaf[field.1.2.840.113618.104.22.168.4] exists)' bin/iPhone/Debug/*********.iOS.app (TaskId:186)
These are the messages logged on my Mac:
codesign: (libsystem_info.dylib) Membership API: translate identifier
codesign: (libsystem_info.dylib) Retrieve User by ID
codesign: (Security) SecTrustEvaluateIfNecessary
codesign: (Security) SecKeychainAddCallback
codesign: (Security) [com.apple.securityd:security_exception] MacOS error: -67054
This is what this error number (67054) translates to:
Error: 0XFFFEFA12 -67054 a sealed resource is missing or invalid
This is what I did so far:
When this error occurs, I usually need to
Most of the times, this works.
Some times, I am too annoyed to do all of the above steps (and more) and so I am trying to invest only the minimum amount of effort to get things working.
Some times this is enough and it works.
Most of the times it doesn't.
When it does not work, I get frustrated and either head over to work with the Android app or do the above steps (and more) after all.
I searched the internet. Of course I did. And there are so (!) many (!) people facing this problem and virtually NO one has a real explanation about what's EXACTLY going on here. Every workaround and/or solution I could find has something to do with deleting certificates and reinstalling them.
However, why can it be that it works now and then I change a line of code, hit run and suddenly I get another codesigning error?
This is like the middleage when women with red hair danced naked around a fireplace and threw stuff like frogeyes, dead animals and mouldy bread into a big bowl and to everyones' surprise, the resulting soup magically healed funny diseases. This is exactly what developers do when the try to get codesigning errors solved while working with Xamarin Forms.
I want you to find out that its the breads' mold which actually cures the people. Go and find the penicillin.