needHelp101
needHelp101

Reputation: 21

[NSNull length]: unrecognized selector sent to instance 0x37fc8e48 iOS Swift

This error always occur when I type something in the keyboard. Where or how can I find the line that cause the error.

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x37fc8e48'
*** First throw call stack:
(0x2367868b 0x34a32e17 0x2367dea5 0x2367bad9 0x235ac258 0x23599f55 0x24386d2f 0x24386c97 0x24389887 0x278ff28f 0x27abf82d 0x27abf933 0x27abf933 0x27abf933 0x27abf933 0x27abf933 0x27abf933 0x27abf933 0x27abf933 0x27abf933 0x27abf933 0x27abf933 0x278fe9b9 0x27ac0067 0x27ac0067 0x27ac0067 0x27ac0067 0x27ac0067 0x27ac0067 0x27ac0067 0x27ac0067 0x27ac0067 0x27ac0067 0x27ac0067 0x27ac0067 0x27ac0067 0x278fe5d3 0x278fe4b3 0x278fd659 0x278fc1c1 0x278fbbaf 0x27766179 0x278f82d3 0x278f80d7 0x27771d0f 0x2776ae67 0x2773c7f5 0x2773afef 0x2363bc3f 0x2363b82d 0x23639b9b 0x2358d249 0x2358d035 0x2c66fad1 0x277a28a9 0xeb114 0x3517e873)
libc++abi.dylib: terminating with uncaught exception of type NSException

Upvotes: 2

Views: 2663

Answers (2)

SHEBIN
SHEBIN

Reputation: 162

somewhere in your code you may be checking length of string. Search and find code and check if it is NSString class then get length of that

Upvotes: 0

gnasher729
gnasher729

Reputation: 52602

The typical reason is that you are processing JSON data, that the server delivered a null value which translates to [NSNull null], and you assumed that it is a string, which it isn't.

When you receive JSON data, that data could contain anything and you need to check it if you don't want to crash.

Upvotes: 3

Related Questions