简体   繁体   中英

Supporting Older iOS Version with MAUI

We have been developing an application and I was using the latest VS with .NET 7 and the latest Xcode (14.1) The app works only with ios 16 or higher but does not work with the older versions like 14.2 or 15.5.

I downgraded the Xcode to 13.4.1 and downgraded VS to 17.3 (I added the version details end of the question)

But I have still Microsoft.ios 16.1.229 and I understand, it works as a workload but I could not downgrade it. I also use now .NET 6.0

Unfortunately I cannot even compile project. I get following warnings and errors.

/.../Platforms/iOS/Helpers/AppleDevicePermissions.cs(102,18): warning CA1416: This call site is
reachable on: 'iOS' 14.2 and later, 'maccatalyst' 14.2 and later.
'UIUserNotificationSettings.Types.get' is unsupported on: 'ios' 10.0 and 
 later, 'maccatalyst' 10.0 and later.
/...../Platforms/iOS/Helpers/AppleDevicePermissions.cs(102,18): warning CA1416: This call site is 
reachable on: 'iOS' 14.2 and later, 'maccatalyst' 14.2 and later
'UIApplication.CurrentUserNotificationSettings.get' is unsupported on: 'ios' 10.0 and later,'maccatalyst'
10.0 and later. [/..../MyApp.csproj]
ILLINK : warning MT0079: The recommended Xcode version for Microsoft.iOS 16.1.229 is Xcode 14.1 or later. 
The current Xcode version (found in /Applications/Xcode.app/Contents/Developer) is 13.4.1.
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.1.229/targets/Xamarin.Shared.Sdk.targets(1007,3): 
error : Failed to AOT compile Microsoft.Maui.dll, the AOT compiler exited with code 1 [/../MyApp.csproj]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.1.229/targets/Xamarin.Shared.Sdk.targets(1007,3): 
error : Failed to AOT compile Microsoft.Maui.Controls.dll, the AOT compiler exited with code 1 
[/....../MyApp.csproj]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.1.229/targets/Xamarin.Shared.Sdk.targets(1007,3):
error : Failed to AOT compile CommunityToolkit.Maui.Core.dll, the AOT compiler exited with code 1 
[/...../MyApp.csproj]

  Visual Studio Professional 2022 for Mac
Version 17.3 (build 2102)
Installation UUID: 29d662e6-697b-4c96-a0cc-d9c2773c0a95

Runtime
.NET 6.0.5 (64-bit)
Architecture: X64

Roslyn (Language Service)
4.3.0-3.22312.2+52adfb8b2dc71ed4278debcf13960f2116868608

NuGet
Version: 6.2.1.2

.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/6.0.400/Sdks
SDK Versions:
    6.0.400
    3.1.422
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    6.0.8
    3.1.28

Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Xamarin.Android
Version: 13.0.0.0 (Visual Studio Professional)
Commit: xamarin-android/d17-3/030cd63
Android SDK: /Users/user/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        12.0 (API level 31)
        11.0 (API level 30)
        13.0 (API level 33)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.2
SDK Build Tools Version: 33.0.0

Build Information: 
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-3@7716ae53
SQLite: xamarin/sqlite/3.38.5@df4deab
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.3.0.23
Hash: 965bf40
Branch: remotes/origin/d17-3
Build date: 2022-08-03 21:18:42 UTC

Android Device Manager
Version: 0.0.0.1169
Hash: fafb1d5
Branch: fafb1d5
Build date: 2022-08-03 21:18:42 UTC

Apple Developer Tools
Xcode 13.4.1 (20504)
Build 13F100

Xamarin.Mac
Version: 8.12.0.2 (Visual Studio Professional)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:54-0400

Xamarin.iOS
Version: 15.12.0.2 (Visual Studio Professional)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:55-0400

Xamarin Designer
Version: 17.3.0.208
Hash: 0de472ea0
Branch: remotes/origin/d17-3
Build date: 2022-08-03 21:18:36 UTC

Build Information
Release ID: 1703002102
Git revision: 7a27f71b7aeb9b846940c9f8994c9ef7a694f0c2
Build date: 2022-08-03 21:16:13+00
Build branch: release-17.3
Build lane: release-17.3

Operating System
Mac OS X 12.6.0
Darwin 21.6.0 Darwin Kernel Version 21.6.0
    Mon Aug 22 20:17:10 PDT 2022
    root:xnu-8020.140.49~2/RELEASE_X86_64 x86_64

UPDATE: I updated VS and Xcode to the latest version and I got this error

/...../MyApp/Platforms/iOS/Info.plist: Error: The MinimumOSVersion value in the Info.plist (11) does not match the SupportedOSPlatformVersion value (16.1) in the project file (if there is no SupportedOSPlatformVersion value in the project file, then a default value has been assumed). Either change the value in the Info.plist to match the SupportedOSPlatformVersion value, or remove the value in the Info.plist (and add a SupportedOSPlatformVersion value to the project file if it doesn't already exist). (MyAppApp) –

here is the related setting in thing info.plist

The problem is solved. Thanks to @HAH and his idea. I downgraded all versions but the problem was not the versions.

As he shared a link https://learn.microsoft.com/en-us/do.net/maui/supported-platforms?view.net-maui-7.0

maui supports ios 11 and higher

So I updated my VS and Xcode to the latest version.

Then I created a complete new maui APP and open its csproj file and compared it with mine. I deleted unnecessary tags from my csproje file and then voilà. I could compile the project and deploy it to an old iphone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM