iOS代码签名键'?苹果分销:我的名字(xxxxxx)'在钥匙扣中找不到
环境:
Windows 10 Home,21H2
VS版本17.3.0 Preview 1.1
我遵循以下步骤以获取此错误:
- 创建一个新的VS Project
- Select .NET MAUI应用程序
- 选择一个文件位置,然后将所有内容设置为将
- 项目配置文件设置为
<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>MauiApp1</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Display name -->
<ApplicationTitle>MauiApp1</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.testapp.maui</ApplicationId>
<ApplicationIdGuid>CE4B9160-2B17-4559-8E4C-EA410A9A7966</ApplicationIdGuid>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Release'">
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
<CodesignKey>Apple Distribution: My Name (xxxxxxx)</CodesignKey>
<CodesignProvision>Apple Provisioning</CodesignProvision>
<ArchiveOnBuild>true</ArchiveOnBuild>
<TcpPort>58181</TcpPort>
<ServerAddress>xxxxx</ServerAddress>
<ServerUser>xxxxx</ServerUser>
<ServerPassword>xxxxx</ServerPassword>
<_DotNetRootRemoteDirectory>/Users/xxxxx/Library/Caches/Xamarin/XMA/SDKs/dotnet/</_DotNetRootRemoteDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-ios|AnyCPU'">
<BuildIpa>True</BuildIpa>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-ios|AnyCPU'">
<BuildIpa>True</BuildIpa>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
连接到构建Mac
- 的Windows App上的Windows运行,成功。
-
运行此命令
dotnet Publish -f:net6.0 -ios -c:版本
错误
iOS代码签名密钥'?苹果分销:我的名字(xxxxxx)'找不到 在钥匙扣中。
- 我还尝试通过VS GUI进行发布(右键单击解决方案 - &GT; Rebuild),然后我会收到此错误:
必须启用代码签名来创建Xcode Archive。
在此之前,
- 我根据此 https://github.com/ dotnet/maui/eskes/4397 和this
-
在我的Apple开发人员帐户中完成了所有必要的步骤
在Mac
上安装了证书-
上安装了 键链中的证书
- 最初在Mac上的密钥链中我的证书显示无效/不信任。执行此操作之后
在错误中标记'?苹果分发:我的名字(xxxxxx)',我不知道它来自哪里。
更新:
我使用此命令在构建过程中创建日志文件。
dotnet publish -f:net6.0-ios -c:Release /bl:msbuild.binlog
可以使用此工具查看日志文件: https://msbuildlog.com/
在此日志文件中,错误消息 没有问号。因此,我猜问号只是编写日志消息时的显示错误。
然后,在Binlog中,它从字面上说:
证书“ Apple发行:我的名字(xxx)”不匹配 '苹果分销:我的名字(xxx)'。
我已经检查了字符的角色。它是完全是相同的字符串。
我还注意到它确实从服务器下载了证书,因为我可以看到在“检测dentectingsigningidentity”之后,在Binlog中列出了证书
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我弄清楚了,这要归功于上一条评论!
字符串
&lt; codesignkey&gt; apple分发:我的名字(xxx)&lt;/codesignkey&gt;
包含一个隐藏的字符。我无法在这篇文章中复制此内容,因为隐藏的字符被过滤了。
但是它可以用字符串到十六进制转换器进行复制: https:// toolz.com/tools/text-hex-convertor.php
键入此十六进制代码:3e e2808c ,它将产生此字符“&lt;”。当您键入3E时,它将产生相同的字符“&lt;”。问题是当复制/粘贴时,隐藏的字符随附。
为了证明这一点,您可以简单地复制/粘贴“&lt;”从第一个产品再次进入工具。
查找角色“ e2808c”,它代表“零宽的非加入者”
https://en.wikipedia.org/wiki/zero-width_non-joiner
https://www.fileformat.info/info/info/unicode/char/ch/chy/char/char/char/ char/ char/index.htm
我不知道这是如何进入字符串的。我也不知道字符串中可能有隐藏的角色!
因此,这些隐藏的字符串之一进入了我的CodeSignkey标签,它将不再匹配。 Visual Studio用问号正确地指出了这一点。但是我对错误的解释是错误的,因为我没想到有一些我看不到的东西。
I figured it out, thanks to the last comment!
The string
<CodesignKey>Apple Distribution: My Name (xxx)</CodesignKey>
contains a hidden character. I can't reproduce this in this post, because the hidden characters get filtered out.
But it can be reproduced with a string to hex converter: https://online-toolz.com/tools/text-hex-convertor.php
Type in this hex code: 3ee2808c and it will produce this character "<". When you type 3e, it will produce the same character "<". The problem is when copy/pasted, hidden characters come with it.
To prove this you can simply copy/paste the "<" from the first product into the tool again.
Looking up the character "e2808c", it stands for a "Zero-width non-joiner"
https://en.wikipedia.org/wiki/Zero-width_non-joiner
https://www.fileformat.info/info/unicode/char/200c/index.htm
How this got into the string, I don't know. I also didn't know that there can be hidden characters in strings!
So then one of these hidden strings got into my CodesignKey tag, and it would not match anymore. Visual Studio pointed this out correctly with a question mark. But my interpretation of the error was wrong, because I didn't expect something to be there that I can not see....