Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting dyld: Symbol not found: _OBJC_CLASS_$_NSJSONSerialization on IOS4

Tags:

iphone

ios4

I get the following error when testing on iOS4:

dyld: Symbol not found: _OBJC_CLASS_$_NSJSONSerialization

While on iOS5 it's working fine.

Any help will be appreciated.

like image 512
shaloms Avatar asked Dec 01 '11 13:12

shaloms


3 Answers

From the AFNetworking README :

"AFNetworking uses NSJSONSerialization if it is available. If your app targets a platform where this class is not available you can include one of the following JSON libraries to your project for AFNetworking to automatically detect and use."

With that being said, to prevent the following error make sure of two things

  1. that JSONKit / SBJson / YAJL are included
  2. That your "Deployment Target" is lower than iOS5 , that way AFNetworking would realize it can't use NSJSONSerialization and will fall back to one of the included JSON parsing classes.

Shai.

like image 79
Shai Mishali Avatar answered Nov 10 '22 00:11

Shai Mishali


@hoshi is right. You can't use NSJSONSerialization on devices running older than iOS 5.0.

Here's the documentation from Apple's site. For my own code I also use the SBJson library.

like image 32
Michael Dautermann Avatar answered Nov 09 '22 23:11

Michael Dautermann


Seems to be that the AFNetworking class is the one that use NSJSONSerialization.

like image 23
shaloms Avatar answered Nov 09 '22 23:11

shaloms