Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 让realm=realm()冻结我的应用程序_Swift_Database_Realm_Local Storage_Realm Mobile Platform - Fatal编程技术网

Swift 让realm=realm()冻结我的应用程序

Swift 让realm=realm()冻结我的应用程序,swift,database,realm,local-storage,realm-mobile-platform,Swift,Database,Realm,Local Storage,Realm Mobile Platform,因为某种原因当我打电话的时候 让realm=realm()它停止处理(不会崩溃)我的代码。另外,当我尝试执行其他查询(添加、删除、获取和其他)时,我的应用程序仍在运行,但屏幕被冻结。我认为您错过了try before Realm() 将代码切换为:let realm=try!Realm()你应该发布你的代码,给我们你使用的函数你有迁移还是什么? let realm = try! Realm() try! realm.write { // do so

因为某种原因当我打电话的时候
让realm=realm()
它停止处理(不会崩溃)我的代码。另外,当我尝试执行其他查询(添加、删除、获取和其他)时,我的应用程序仍在运行,但屏幕被冻结。

我认为您错过了try before Realm()


将代码切换为:let realm=try!Realm()你应该发布你的代码,给我们你使用的函数你有迁移还是什么?
   let realm = try! Realm()
        try! realm.write {
             // do something
            }