Is it possible to use core data (Xcode 8 and Swift 3.0) with both iOS 9 and 10 ?

巧了我就是萌 提交于 2020-01-24 12:48:33

问题


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


回答1:


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.




回答2:


For anyone looking for it, I added the core data template generated by xcode 7 (swift 2) and its swift 3 conversion in this answer: https://stackoverflow.com/a/39814217/3034715



来源:https://stackoverflow.com/questions/38140188/is-it-possible-to-use-core-data-xcode-8-and-swift-3-0-with-both-ios-9-and-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!