2

I built a small iOS application which uses Realm instead of CoreData. The app does not require a login as it only stores data entered by the user. I'm currently trying to save users data so that if a user deleted the app for example, the data will be there by default the next the app is re-installed.

Here's where I am getting confused. Can I still use Realm Mobile Platform even though the app will not require a login screen. (i.e. data will automatically be saved for users who are logged-in to their iCloud accounts).

Here's what I've done so far:

  1. I configured Realm Object Server on an AWS EC2 instance, and I can login to the realm dashboard through the browser just fine.
  2. I configured the cloudKit stanza in the configuration.yml file as per the authentication instructions.
  3. In my setupRealm() func, I tried the following code but I keep getting a parameters validation error:

    SyncUser.logIn(with: cloudKitCredentials,
                   server: serverURL) { user, error in
                    if let user = user {
                        print("in")
                    }
    
                    else if let error = error {
                        fatalError(String(describing: error))
                        // Error: "Your request parameters did not validate."
                    }
    

    This is the error message:

    Error Domain=io.realm.sync Code=3 
    "Your request parameters did not validate." 
    UserInfo={statusCode=400, 
              NSLocalizedDescription=Your request parameters did not validate.}:
    

I suspect that the my iCloud user is not being tied with the object server, but I can't seem to put the pieces together. I'd appreciate any pointers.


  • The `auth` section of the configuration file has nothing to do with the CloudKit authentication. This is used for the authentication process between the ROS and sync clients. There is no reason to change them, other than for security reasons. Does the server show any specific logs when you try to log in? – teotwaki Feb 17 '17 at 15:42
  • No, nothing. I just tried to login while the log screen was opened. Nothing logged when I ran the app. – j_theislander Feb 17 '17 at 15:55
  • Sorry, I should have been clearer: Could you bump up the logging to `all` and see if anything jumps to mind? – teotwaki Feb 17 '17 at 16:02
  • I'm sorry, but I don't see a filter option for the logs. The way I currently view the log of my instance is by clicking on: Actions > Instance Settings > Get System Log. – j_theislander Feb 17 '17 at 16:12
  • You have to edit the configuration file :) – teotwaki Feb 17 '17 at 16:25
  • Oh okay! I just configured it to `all`, but nothing logged from today's attempts. I'll edit my post to show the last few lines of the log of `/var/log/realm-object-server.log`. – j_theislander Feb 17 '17 at 16:39
  • Note that you have to re-run your test after changing the configuration. – teotwaki Feb 17 '17 at 16:40
  • Yeah, I did the re-run before copying the log. Still nothing though. I just edited the question with the log. – j_theislander Feb 17 '17 at 16:45
  • And you restarted the server after changing the config? – teotwaki Feb 17 '17 at 16:46
  • No! Sorry - I wasn't aware that was necessary. – j_theislander Feb 17 '17 at 16:47
  • Most of this is covered in the documentation. I'm off for the weekend. I'll look at this on Monday. – teotwaki Feb 17 '17 at 16:50
  • It worked - I now understand that all I had to do was restart the server. Thanks a lot @teotwaki for walking me through it. Much appreciated. – j_theislander Feb 17 '17 at 19:07
  • No worries, happy to help. Make sure to turn the logging back down, as it can generate quite a lot of data (and use up disk space) for nothing. – teotwaki Feb 17 '17 at 21:33

1 Answers1

0

The server requires a restart after editing the authentication lines in the configuration.yml.