简体   繁体   English

使用 MAUI 支持旧版本 iOS

[英]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.我们一直在开发一个应用程序,我使用的是最新的 .NET 7 和最新的 Xcode (14.1) 该应用程序仅适用于 ios 16 或更高版本,但不适用于 14.2 或 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)我将 Xcode 降级为 13.4.1 并将 VS 降级为 17.3(我在问题末尾添加了版本详细信息)

But I have still Microsoft.ios 16.1.229 and I understand, it works as a workload but I could not downgrade it.但我仍然有 Microsoft.ios 16.1.229 并且我明白,它作为工作负载工作,但我无法降级它。 I also use now .NET 6.0我现在也在用 .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更新:我将 VS 和 Xcode 更新到最新版本,但出现此错误

/...../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). /...../MyApp/Platforms/iOS/Info.plist: Error: Info.plist (11) 中的 MinimumOSVersion 值与项目文件中的 SupportedOSPlatformVersion 值 (16.1) 不匹配(如果没有 SupportedOSPlatformVersion 值在项目文件中,则采用默认值)。 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).更改 Info.plist 中的值以匹配 SupportedOSPlatformVersion 值,或者删除 Info.plist 中的值(如果 SupportedOSPlatformVersion 值尚不存在,则将其添加到项目文件中)。 (MyAppApp) – (MyAppApp) –

here is the related setting in thing info.plist这是 thing info.plist 中的相关设置

The problem is solved.问题已经解决了。 Thanks to @HAH and his idea.感谢@HAH 和他的想法。 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正如他分享的链接https://learn.microsoft.com/en-us/do.net/maui/supported-platforms?view.net-maui-7.0

maui supports ios 11 and higher maui 支持 ios 11 及更高版本

So I updated my VS and Xcode to the latest version.所以我将我的 VS 和 Xcode 更新到最新版本。

Then I created a complete new maui APP and open its csproj file and compared it with mine.然后我创建了一个全新的maui APP并打开它的csproj文件并与我的进行了比较。 I deleted unnecessary tags from my csproje file and then voilà.我从我的 csproje 文件中删除了不必要的标签,然后 voilà。 I could compile the project and deploy it to an old iphone.我可以编译这个项目并将它部署到一个旧的 iPhone 上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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