【问题标题】:iOS Swift Realm asyncOpen not working without internetiOS Swift Realm asyncOpen 在没有互联网的情况下无法工作
【发布时间】:2017-06-28 05:49:15
【问题描述】:
let config = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: realmURL))

Realm.asyncOpen(configuration: config) { realm, error in
  if let realm = realm {

    // Realm successfully opened, with all remote data available
  }
else if let error = error {
    // Handle error that occurred while opening or downloading the contents of the Realm
  }
}

我使用上面的代码获得了异步打开领域,但是没有互联网它就无法工作。

【问题讨论】:

    标签: ios swift realm


    【解决方案1】:

    根据领域Documents

    此外,同步领域会等待所有可用的远程内容 在操作开始下载并可用时 本地。

    syncConfiguration: 将等待所有可用的远程内容

    例如:

    let config = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: realmURL))
    Realm.asyncOpen(configuration: config) { realm, error in
      if let realm = realm {
        // Realm successfully opened, with all remote data available
      } else if let error = error {
        // Handle error that occurred while opening or downloading the contents of the Realm
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-24
      • 2017-12-07
      • 2018-01-31
      • 1970-01-01
      • 1970-01-01
      • 2021-09-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多