.net MAUI无法看到iOS方法和属性,因为它处于禁用状态

50few1ms  于 2023-03-20  发布在  .NET
关注(0)|答案(1)|浏览(147)

我最近把xamarin表单项目集成到了.net maui中,我可以看到android自定义方法,但是在iOS中它显示为禁用。
P.S:它的工作正常,但我没有得到任何iOS的建议.

我的目标iOS版本以及.
.CsProj

<PropertyGroup>
        <TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.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);net7.0-tizen</TargetFrameworks> 
        <OutputType>Exe</OutputType>
        <RootNamespace>MobileApp</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>

        <!-- Display name -->
        <ApplicationTitle>Test</ApplicationTitle>

        <!-- App Identifier -->
        <ApplicationId>com.test.demo</ApplicationId>
        <ApplicationIdGuid>65aa90ec-865a-4ee8-9d89-2f66fc2438e8</ApplicationIdGuid>

        <!-- Versions -->
        <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
        <ApplicationVersion>1</ApplicationVersion>

        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</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>
        <Configurations>Release;Debug</Configurations>
        <UserSecretsId>1cde96b1-590c-4af8-a8a8-b6de3c7a3c67</UserSecretsId>
    </PropertyGroup>

有人能帮我一下吗?

xzlaal3s

xzlaal3s1#

通过使用条件编译或使用分部类和分部方法,可以从跨平台代码调用平台代码。
你可以选择平台来让代码亮起来,就像这样:

相关问题