.NET MAUI ios Application Crashes When Published. Can Someone Guide me?

Gayantha Anushan 0 Reputation points
2024-08-15T03:17:51.58+00:00

I maintaining .NET MAUI application that are created using .NET MAUI Blazor hybrid application project. now wwe need to publish it on Apple Appstore and there also some platform specific codes for android as well. so what i did is create .NET MAUI multi project and configured projects seperately. then i published windows version and android version and ios versions. when debugging ios application there is no problem in simulator. but after publishing that project to appstore I getting rejected because app is crashing when launching in iPad Air

here is my code in csproj file

<Project Sdk="Microsoft.NET.Sdk.Razor">

	<PropertyGroup>
		<TargetFramework>net8.0-ios</TargetFramework>
		<SupportedOSPlatformVersion>11.0</SupportedOSPlatformVersion>
		<OutputType>Exe</OutputType>
		<Nullable>enable</Nullable>
		<ImplicitUsings>enable</ImplicitUsings>
		<UseMaui>true</UseMaui>
		<EnableDefaultContentItems>false</EnableDefaultContentItems>
	</PropertyGroup>

	<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
	  <BuildIpa>False</BuildIpa>
	</PropertyGroup>

	<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
	  <BuildIpa>True</BuildIpa>
		<MtouchLink>SdkOnly</MtouchLink>
		<UseInterpreter>true</UseInterpreter>
	</PropertyGroup>

    <!-- I removed wwwroor files integration for here. because it seems not relevent -->

</Project>

here is my Info.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDisplayName</key>
    <string>***********</string>
    <key>CFBundleIdentifier</key>
    <string>************</string>
    <key>CFBundleShortVersionString</key>
    <string>3.0</string>
    <key>CFBundleVersion</key>
    <string>3.0</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UIDeviceFamily</key>
    <array>
        <integer>1</integer>
        <integer>2</integer>
    </array>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>XSAppIconAssets</key>
    <string>Assets.xcassets/AppIcon.appiconset</string>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string>Location Permission is Required for Attendance forms.</string>
	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
	<string>Location Permission is Required for Attendance forms.</string>
	<key>NSCameraUsageDescription</key>
	<string>Camera permission Required for Barcode scanning feature and attachment upload feature</string>
	<key>NSMicrophoneUsageDescription</key>
	<string>Required for Implement Voice Command features.</string>
</dict>
</plist>

here is my entitlements.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>keychain-access-groups</key>
	<array>
		<string>$(AppIdentifierPrefix)******_bundle_name****</string>
	</array>
</dict>
</plist>

can someone give me workaround?

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,596 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,593 questions
.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
337 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 66,621 Reputation points
    2024-08-15T17:46:26.3233333+00:00

    the error is just an uncaught exception. that is your code throw an exception. may be related to layout on an iPad. your code is failing on a iPad Air 5th Gen (Wi-Fi) - OS 17.6


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.