2017-06-28 50 views
1
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 asyncOpen不能在沒有互聯網的情況下工作

回答

0

按照境界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 
    } 
} 
相關問題