what does __NSCFLocalDownloadFile: error 24 opening for ioChannel mean?

I get this error after leaving my app running for about half an hour. It is fetching a json feed every few seconds and will eventually stop doing so when this error occurs.

Replies

Error 24 is almost certainly

EMFILE
, which means your app has run out of file descriptors. You usually get this when someone ‘leaks’ a file descriptor, that is, opens a file but doesn’t close it. This could be code in the OS but it’s more likely to be your code.

Does the problem reproduce on the simulator? If so, you can run

lsof
to figure out what files are open in your process, and from there hunt the leak. For example:
$ lsof -p `pgrep xxis2`
COMMAND  PID  USER FD    TYPE DEVICE SIZE/OFF    NODE NAME
…
xxis2  9601 quinn  0r    CHR    3,2      0t0      302 /dev/null
xxis2  9601 quinn  1u    CHR  16,4      0t0    1363 /dev/ttys004
xxis2  9601 quinn  2u    CHR  16,4      0t0    1363 /dev/ttys004
xxis2  9601 quinn  3u  KQUEUE                          count=2, state=0x12
xxis2  9601 quinn  4r    REG    1,4        0 81530947 …/memory_warning_simulation
xxis2  9601 quinn  5u    unix …          0t0          ->0x5a9f59bfb599f0e9
xxis2  9601 quinn  6r    REG    1,4    5588 81132880 …/US.uchr

where

xxis2
is the name of my app.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"