xcode 支持 iOS 7 与 iOS 8 兼容的应用程序,包括扩展

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25965391/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:39:00  来源:igfitidea点击:

Supporting iOS 7 with iOS 8 compatible app that includes extensions

iosxcode

提问by Hamlier Walp

I have built an app for iOS 8 using the Today widget extension. I was wondering how to make sure that people with iOS 7 could still download and use the app.

我已经使用 Today 小部件扩展为 iOS 8 构建了一个应用程序。我想知道如何确保使用 iOS 7 的人仍然可以下载和使用该应用程序。

Do I make the Today widget development target iOS 8 but the actual app development target iOS 7?

我是否将 Today 小部件开发目标设为 iOS 8,而实际应用程序开发目标为 iOS 7?

采纳答案by hagi

You're on the right track: The app needs to be built with the iOS 8 SDK and can have an earlier deployment target. The widget's deployment target is iOS 8, and it will be ignored on iOS 7 devices. You can easily verify that in the simulator, too.

您走对了:该应用程序需要使用 iOS 8 SDK 构建,并且可以具有较早的部署目标。小部件的部署目标是 iOS 8,它将在 iOS 7 设备上被忽略。您也可以在模拟器中轻松验证。

If you share code between the widget and the app, this code needs to work in iOS 7 and 8, obviously. Specifically, if you use frameworks to share code between your app and the widget (which is recommended by Apple), you should read this document. However, it seems to be easier to just not use (own, embedded) frameworks as long as you target iOS 7.

如果您在小部件和应用程序之间共享代码,则此代码显然需要在 iOS 7 和 8 中工作。具体来说,如果您使用框架在您的应用程序和小部件之间共享代码(Apple 推荐),您应该阅读此文档。但是,只要您面向 iOS 7,不使用(自己的、嵌入式的)框架似乎更容易。

回答by Karsten

hagi is right, but we have tried to run apps with frameworks on ios7 and it worked. But the best way is with weak linking and check.

hagi 是对的,但我们已经尝试在 ios7 上运行带有框架的应用程序并且它有效。但最好的方法是使用弱链接和检查。

It is a bad scenario, because in our frameworks is nearly all non-UI code: model, parser and loading.

这是一个糟糕的场景,因为在我们的框架中几乎所有非 UI 代码:模型、解析器和加载。

回答by mr.pd

  1. Check the OS version and make a fallback behavior for

    NSString *osVersion = [[UIDevice currentDevice] systemVersion];

  2. Check if you have access to the functions you wish to use:

    [YourClass respondsToSelector:@selector(yourDesiredFunction)]

  1. 检查操作系统版本并为

    NSString *osVersion = [[UIDevice currentDevice] systemVersion];

  2. 检查您是否有权访问要使用的功能:

    [YourClass RespondsToSelector:@selector(yourDesiredFunction)]

Apple's SDK Compatibility Guide: https://developer.apple.com/library/ios/documentation/developertools/conceptual/cross_development/Introduction/Introduction.html

Apple 的 SDK 兼容性指南:https: //developer.apple.com/library/ios/documentation/developertools/conceptual/cross_development/Introduction/Introduction.html