iOS 9和iOS 10是否可以使用核心数据(Xcode 8和Swift 3.0)? [英] Is it possible to use core data (Xcode 8 and Swift 3.0) with both iOS 9 and 10 ?

查看:74
本文介绍了iOS 9和iOS 10是否可以使用核心数据(Xcode 8和Swift 3.0)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Swift 3 Xcode 8中启动新应用并支持iOS 8.4 / 9.x
如何处理核心数据?

I want start new app in Swift 3 Xcode 8 and support iOS 8.4/9.x How to deal with Core Data ?

推荐答案

是的,很容易做到。 Swift 3旨在在iOS v8 +上运行。不过,您将只能使用iOS v8.4支持的API子集。找出问题答案的最佳方法是创建一个使用Core Data的测试项目。您会发现 NSPersistentContainer 会产生错误。为什么?在较早的操作系统上不可用。或者,使用Xcode 7创建一个测试项目,然后将其迁移到Swift 3,您会发现它可以在任何地方轻松工作。

Yes, it is easily possible. Swift 3 is targeted to run on iOS v8+. You will only be able to use the subset of APIs supported on iOS v8.4 though. The best way to find out the answer to your question though is to create a test project that uses Core Data. You'll find that NSPersistentContainer creates an error. Why? It isn't available on the earlier OSes. Alternatively, create a test project with Xcode 7 and then migrate it to Swift 3, you'll see that it can easily work every where.

这篇关于iOS 9和iOS 10是否可以使用核心数据(Xcode 8和Swift 3.0)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆