3

I am following the realm swift getting started guide here and it is working fine. I have the following object:

class Dog: Object {
  dynamic var name = ""
  dynamic var age = 0
}

and in my viewcontroller I have

override func viewDidLoad() {
    super.viewDidLoad()

    print(Realm.Configuration.defaultConfiguration.fileURL!)

    let myDog = Dog()
    myDog.name = "Rex"
    myDog.age = 1

    let realm = try! Realm()

    try! realm.write {
      realm.add(myDog)
    }
}

little snitch reports that realm tries to connect to static.realm.io and api.mixpanel.com. How do I stop realm from attempting to connect to various servers if I only want to use it locally?

Seb123
  • 471
  • 1
  • 7
  • 20

1 Answers1

7

It's intended behavior.

Realm collects anonymous analytics when your app is run with a debugger attached, or when it runs in a simulator.

Please see our doc for more details.

https://realm.io/docs/swift/latest/#i-see-a-network-call-to-mixpanel-when-i-run-my-app-what-is-that

It doesn't happen in a release build. To prevent this even in debug build, set environment variable named REALM_DISABLE_ANALYTICS.

See also https://github.com/realm/realm-cocoa/blob/master/Realm/RLMAnalytics.mm#L37-L44

kishikawa katsumi
  • 10,418
  • 1
  • 41
  • 53