A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
MAUI: iOS Build Issues in Visual Studio Code
I am getting below error when running the MAUI app on mac visual studio code:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_18.0/18.0.8319/targets/Xamarin.Shared.Sdk.targets(1648,3): error : clang++ exited with code 1: [/Users/sreejith.sreenivasan/Downloads/inv-hnas337-mobile-patient/Inventiva/Inventiva.csproj::TargetFramework=net8.0-ios] /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_18.0/18.0.8319/targets/Xamarin.Shared.Sdk.targets(1648,3): error : Undefined symbols for architecture arm64: [/Users/sreejith.sreenivasan/Downloads/inv-hnas337-mobile-patient/Inventiva/Inventiva.csproj::TargetFramework=net8.0-ios] /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_18.0/18.0.8319/targets/Xamarin.Shared.Sdk.targets(1648,3): error : "_swift_FORCE_LOAD$_swiftCompatibility56", referenced from: [/Users/sreejith.sreenivasan/Downloads/inv-hnas337-mobile-patient/Inventiva/Inventiva.csproj::TargetFramework=net8.0-ios] /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_18.0/18.0.8319/targets/Xamarin.Shared.Sdk.targets(1648,3): error : _swift_FORCE_LOAD$swiftCompatibility56$_FirebaseAnalytics in FirebaseAnalytics[arm64]17 [/Users/sreejith.sreenivasan/Downloads/inv-hnas337-mobile-patient/Inventiva/Inventiva.csproj::TargetFramework=net8.0-ios] /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_18.0/18.0.8319/targets/Xamarin.Shared.Sdk.targets(1648,3): error : "_swift_FORCE_LOAD$_swiftCompatibilityConcurrency", referenced from: [/Users/sreejith.sreenivasan/Downloads/inv-hnas337-mobile-patient/Inventiva/Inventiva.csproj::TargetFramework=net8.0-ios] /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_18.0/18.0.8319/targets/Xamarin.Shared.Sdk.targets(1648,3): error : _swift_FORCE_LOAD$swiftCompatibilityConcurrency$_FirebaseAnalytics in FirebaseAnalytics[arm64]17 [/Users/sreejith.sreenivasan/Downloads/inv-hnas337-mobile-patient/Inventiva/Inventiva.csproj::TargetFramework=net8.0-ios] /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_18.0/18.0.8319/targets/Xamarin.Shared.Sdk.targets(1648,3): error : ld: symbol(s) not found for architecture arm64 [/Users/sreejith.sreenivasan/Downloads/inv-hnas337-mobile-patient/Inventiva/Inventiva.csproj::TargetFramework=net8.0-ios] /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_18.0/18.0.8319/targets/Xamarin.Shared.Sdk.targets(1648,3): error : clang++: error: linker command failed with exit code 1 (use -v to see invocation) [/Users/sreejith.sreenivasan/Downloads/inv-hnas337-mobile-patient/Inventiva/Inventiva.csproj::TargetFramework=net8.0-ios] 2869 Warning(s) 1 Error(s) Time Elapsed 00:01:15.59
My Xcode version:
xcodebuild -version
Xcode 16.4
Build version 16F6
Dotnet version:
Version: 8.0.412
Workload details:
maui-ios 8.0.100/8.0.100 SDK 8.0.400
maui 8.0.100/8.0.100 SDK 8.0.400
In my MAUI project I have added .NET class library and .NET MAUI class library project. I have alsi added a global.json to force use .NET 8 like below.
{
"sdk":
{
"version": "8.0.412"
}
}
To fix the error I have added a PropertyGroup like below on my MAUI project .csproj.
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0-ios'">
<MtouchLink>SdkOnly</MtouchLink>
<_EnableSwiftSupport>true</_EnableSwiftSupport>
</PropertyGroup>
None of them resolves the issue, please suggest the correct solution.