Realm-cocoa: Realm crashes when Phone has low storage

Created on 15 Apr 2019  路  1Comment  路  Source: realm/realm-cocoa

Goals

To be able to run the app or view even when phone has a low storage

Expected Results

When going to the view, don't crash

Actual Results

It crashes with this error:

Thread 10: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=io.realm Code=1 "fcntl() inside prealloc() failed allocating 1184 bytes, new_size=1184, cur_size=0, allocated_size=0, event: No space left on device" UserInfo={NSLocalizedDescription=fcntl() inside prealloc() failed allocating 1184 bytes, new_size=1184, cur_size=0, allocated_size=0, event: No space left on device, Error Code=1}

Steps to Reproduce

  • Fill phone with data (may be useless) to a point where phone prompts low storage. prefereably lower than 10 mb
  • Open app
  • Go to a view using realm

Code Sample

self.token = realm.objects(Data.self).sorted(byKeyPath: "date", ascending: false).observe({ change in ...

Version of Realm and Tooling

Realm framework version: 3.14.1

Xcode version: 10.2

iOS/OSX version: 10.14.4

O-Community T-Help

Most helpful comment

If you don't want to crash when an i/o error occurs then handle the error with do/catch rather than using try!.

>All comments

If you don't want to crash when an i/o error occurs then handle the error with do/catch rather than using try!.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheHmmka picture TheHmmka  路  3Comments

matteodanelli picture matteodanelli  路  3Comments

xspyhack picture xspyhack  路  3Comments

menhui222 picture menhui222  路  3Comments

yangmeyer picture yangmeyer  路  3Comments