简体   繁体   English

XCode 编译错误:confirmationDialog 仅可用 IOS 15.0 或更高版本

[英]XCode compile error: confirmationDialog is only available IOS 15.0 or newer

I'm an apprentice of Swift language and having an online course with tutorials.我是 Swift 语言的学徒,并且有一个带教程的在线课程。

While I was coding along with the instructor there was this "confirmationDialog is only available IOS 15.0 or newer."当我和讲师一起编码时,有这个“confirmationDialog 仅适用于 IOS 15.0 或更高版本”。 error presented.出现错误。 I had to write if #available(iOS 15.0, *) as compiler suggested.我必须按照编译器的建议编写if #available(iOS 15.0, *) However the instructors compiler did not present the same error and she did not make any changes on her code.然而,讲师的编译器并没有出现同样的错误,她也没有对她的代码进行任何更改。

My question is that why the above mentioned error occured on my compiler but not on the instructors?我的问题是为什么上面提到的错误发生在我的编译器上而不是讲师身上? and how can I get rid of this error without adding if #available(iOS 15.0, *) ?以及如何在不添加if #available(iOS 15.0, *)的情况下摆脱此错误?

Thank you in advance.先感谢您。

The reason for the difference in your environment vs your instructors is that your instructor has their "deployment target" set to iOS 15 and yours is set to something lower like iOS 14 or 13. The deployment target setting governs the minimum version of iOS that your app is allowed to run on.您的环境与您的讲师之间存在差异的原因是您的讲师将他们的“部署目标”设置为 iOS 15,而您的设置为更低的值,例如 iOS 14 或 13。部署目标设置管理您的 Z1BDF605989204 的最低版本 Z1BDF605999204允许应用程序运行。 Your instructor's app can only run on iOS 15 and later, so they don't need to use if #available(iOS 15.0, *) .您的讲师的应用程序只能在 iOS 15 及更高版本上运行,因此他们不需要使用if #available(iOS 15.0, *) This condition would always be true for them.这种情况对他们来说永远是正确的。 In your case, since your app supports iOS 14, there are some scenarios where the confirmationDialog API will not be available to the user (since it was added in iOS 15), which is why you need the check.在您的情况下,由于您的应用程序支持 iOS 14,因此在某些情况下,用户无法使用confirmationDialog对话框 API(因为它已添加到 iOS 15 中,这就是您需要的原因) If you are okay with using a minimum version of iOS 15 like your instructor, you can change this setting in Xcode.如果您可以像您的讲师一样使用最低版本的 iOS 15,您可以在 Xcode 中更改此设置。 Click your project name in the project navigator, click your app target, then click the "General" tab.在项目导航器中单击您的项目名称,单击您的应用程序目标,然后单击“常规”选项卡。 You should see an area called "Deployment Info" and a dropdown for the iOS version.您应该看到一个名为“部署信息”的区域和一个 iOS 版本的下拉列表。 Change this to iOS 15.将此更改为 iOS 15。

暂无
暂无

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

相关问题 “...仅在 iOS 13.0 或更高版本中可用”在针对 iOS 15.0 的项目中 - "... is only available in iOS 13.0 or newer" in a project targeting iOS 15.0 NSManagedObjectContext Async/Await perform(schedule:_:)' 仅在 iOS 15.0 或更高版本中可用 - NSManagedObjectContext Async/Await perform(schedule:_:)' is only available in iOS 15.0 or newer Xcode UI测试:lldb错误“仅适用于iOS 9.0或更高版本” - Xcode UI Testing: lldb error “only available on iOS 9.0 or newer” Xcode 11 “'==' 仅在 iOS 13.0 或更高版本中可用”错误 - Xcode 11 “'==' is only available in iOS 13.0 or newer” error Swift 编译器错误 (Xcode):Concurrency is only available in iOS 15.0.0 or newer - Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer Xcode 7-'xxx'仅在iOS 8.0或更高版本上可用 - Xcode 7 - 'xxx' is only available on iOS 8.0 or newer Xcode 10'frame'仅适用于iOS 12.0或更新的编译错误iOS 12 beta - Xcode 10 'frame' is only available on iOS 12.0 or newer compilation error iOS 12 beta Xcode 11 向后兼容性:“UIWindowScene 仅适用于 iOS 13 或更高版本” - Xcode 11 backward compatibility: "UIWindowScene is only available in iOS 13 or newer" Xcode 11 beta -playbackState 仅在 iOS 13.0 或更新版本中可用 - Xcode 11 beta - playbackState is only available in iOS 13.0 or newer 如何修复“并发仅在 iOS 15.0.0 或更高版本中可用”错误 Flutter - How to fix "Concurrency is only available in iOS 15.0.0 or newer" error Flutter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM