I am trying to sync data between my iOS app and Android app. An Android application can read from Realm just fine, but my Swift program fights and the error message is not very informative.
I get this error message:
2016-11-08 08:53:43.919 iOSRealm[2629:65667] Sync: Connection[1]: Session[1]: Bad changeset received: Assertion failed: left().nullable == right().nullable
I have no idea what this means or how to fix it. This is how I authenticate myself to a Realm Object server:
private func synchronouslyLogInUser() throws { SyncUser.authenticateWithCredential(Credential.usernamePassword(username, password: password, actions:.UseExistingAccount), authServerURL: authURL) { (user, error) in print("sent login request") if let user = user { print("user was not nil") self.setDefaultRealmConfiguration(user) } if let error = error where error.code == SyncError.HTTPStatusCodeError.rawValue && (error.userInfo["statusCode"] as? Int) == 400 { print("invalid user and pass") } else { print(error) } } } private func setDefaultRealmConfiguration(user: SyncUser) { Realm.Configuration.defaultConfiguration = Realm.Configuration(syncConfiguration: (user, realmURL), objectTypes: [Weather.self, Wind.self]) Realm.Configuration.defaultConfiguration.deleteRealmIfMigrationNeeded = true realm = try! Realm() }
I see the output that is printed on the console, so I know that the login attempt was successful. I do not think this is a problem with an inappropriate database, because I set the deleteRealmIfMigrationNeeded flag to true .
What does this error message mean and how to fix it?
Relevant Real Realm server logs can be found here: http://pastebin.com/raw/J9mU4H0u - my apologies for the link outside the site, but this is a long log file.
My Swift Models:
class Weather : Object { dynamic var id = 0 dynamic var date = "" dynamic var forecast = "" dynamic var humidity = "" dynamic var wind: Wind! override class func primaryKey() -> String? { return "id" } } class Wind: Object { dynamic var direction = "" dynamic var speed = "" }
Android Models:
public class Weather extends RealmObject { @PrimaryKey public int id; public String date; public String forecast; public String humidity; public Wind wind; } public class Wind extends RealmObject { public String direction; public String speed; }
Thanks in advance!
source share