Sync Url and Credentials

Hi,

I am trying to implement syncing from my iOS app to the sync url.But in sync ( beta) , I have sync enabled but I don’t see the sync url or credentials for it. What is the credentials and serverURL that I need to provide below?

https://realm.mongodb.com/groups/*************/apps/**********/sync/config

[RLMSyncUser logInWithCredentials:credentials
authServerURL:serverURL
onCompletion:^(RLMSyncUser *user, NSError *error) {
if (user) {
RLMRealmConfiguration *config = [user configuration];
[RLMRealm asyncOpenWithConfiguration:config
callbackQueue:dispatch_get_main_queue()
callback:^(RLMRealm *realm, NSError *error) {
if (realm) {
// …
}
}];
}
}];

How do I convert this from swift to objective-c

let app = App(id: “application-0-iiii”)
let user = app.currentUser()!
let partitionValue = “myPartition”
Realm.asyncOpen(configuration: user.configuration(partitionValue: partitionValue),
callback: { (maybeRealm, error) in
guard error == nil else {
fatalError(“Failed to open realm: (error!)”)
}
guard let realm = maybeRealm else {
fatalError(“realm is nil!”)
}
// realm opened
})

is there a way I sync automatically via applicationid only?

@Krikor_Herlopian We are working on a Obj-C guide but until then you can take a look at our API docs - for instance -
https://docs.mongodb.com/realm-sdks/objc/latest/Classes/RLMApp.html#/c:objc(cs)RLMApp(cm)appWithId:

You can use anonymous auth if you dont want to login -

1 Like