V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
AlwaysBee
V2EX  ›  iDev

各位 iOSer,你们的应用有因为 iOS14 的小组件特性,导致崩溃次数猛增吗?尤其是用了 core data

  •  
  •   AlwaysBee · 2020-12-15 10:43:44 +08:00 · 3076 次点击
    这是一个创建于 1199 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近发现上线了新的小组件之后,包含了 core data 数据展示的小组件的应用崩溃率猛增,原本有想过是不是调用方式不对,但发现并不是。

    下面这个代码是新建项目是自动生成的

    import CoreData
    
    struct PersistenceController {
        static let shared = PersistenceController() // 看日志是这行报错,但测试的时候,小组件能够正常使用
       //其他代码省略
    }
    
    7 条回复    2021-01-29 14:33:18 +08:00
    neverfall
        1
    neverfall  
       2020-12-15 12:31:26 +08:00   ❤️ 1
    千万不要去使用 core data
    血泪史
    AlwaysBee
        2
    AlwaysBee  
    OP
       2020-12-15 12:59:07 +08:00
    @neverfall 可以详述一下吗
    matrix77777
        3
    matrix77777  
       2020-12-15 12:59:50 +08:00 via iPhone   ❤️ 1
    @AlwaysBee 问题太多了
    AlwaysBee
        4
    AlwaysBee  
    OP
       2020-12-15 13:03:29 +08:00
    @matrix77777 大佬说一下你的情况?
    neverfall
        5
    neverfall  
       2020-12-15 15:00:26 +08:00   ❤️ 1
    @AlwaysBee core data 的 api 很不友好,而且很多操作都没有线程安全保护。 如果你想用好 core data, 不要一知半解的用,反正我 15 年之后就没再碰过 core data 相关的 api,
    推荐你用开源的第三方数据库管理库,比 core data 好用还方便
    connyyue
        6
    connyyue  
       2021-01-04 11:09:01 +08:00
    千万不要使用 CoreData
    kfchyc
        7
    kfchyc  
       2021-01-29 14:33:18 +08:00
    你的 init 方法内容是什么?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5375 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 09:12 · PVG 17:12 · LAX 02:12 · JFK 05:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.