realm-swift: Realm 1.0.2 crashes on iOS 9.2, the first time the app runs

Goals

I want to launch my app on iOS 9.2, without crashing at startup.

Expected Results

The app continuing to run.

Actual Results

For a newly installed app, on iOS 9.2, it crashes the instant let realm = try! Realm() is called. When I relaunch the app, I don’t get this.

I get this in the debug logs: fatal error: ‘try!’ expression unexpectedly raised an error: Error Domain=io.realm Code=2 “No such file or directory” UserInfo={Error Code=2, NSFilePath=/Users/skydivedan/Library/Developer/CoreSimulator/Devices/0B6BA577-C0DB-482D-94F5-526CD58EEF17/data/Containers/Data/Application/1552DB95-B011-4E55-B967-F2C1DAB507B1/Documents/default.realm, Underlying=n/a, NSLocalizedDescription=No such file or directory}: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-703.0.18.8/src/swift/stdlib/public/core/ErrorType.swift, line 54

Steps to Reproduce

What are steps we can follow to reproduce this issue?

1 - debugged on iPhone 6s Simulator in Xcode. 2 - copy/paste the code defined here: https://realm.io/docs/swift/latest/#defining-migrations

Code Sample

This code is the first first thing that is called in application:didFinishLaunching. 3 - If this is a test app, remove the old app from the simulator/device, so that it gets installed. There’s no documents or settings belonging to this app yet.

Provide a code sample or test case that highlights the issue. Code copied directly from your site. First thing that’s called in didFininshLaunching. https://realm.io/docs/swift/latest/#defining-migrations

Version of Realm and Tooling

Realm version: RealmSwift 1.0.2

Xcode version: 7.3

iOS/OSX version: iOS 9.2

Dependency manager + version: cocoapods 1.0.1

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (17 by maintainers)

Most upvoted comments

we’ll be reaching out to them shortly.

@jpsim I created a sample project with just Apptimize and Realm and it causes this crash: https://github.com/MikeSilvis/apptimize-realm

I am also reaching out to Apptimize. Thanks