Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Urban Airship crashes when calling takeoff

Upgrading to UrbanAirship 3.0.0 with Xcode 5.0, I'm getting an error when calling this code:

[UAirship takeOff:config];

The error is

+[NSJSONSerialization stringWithObject:]: unrecognized selector sent to class 0x3b2ca9fc
2013-09-19 15:02:31.981 [178:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSJSONSerialization stringWithObject:]: unrecognized selector sent to class 0x3b2ca9fc'

This doesn't seem to appear when setting the key "inProduction" to "YES" in the AirshipConfig.plist, which makes sense as calling takeOff: populates the instance of UAirShip. It seems to be due to the category NSJSONSerialization+UAAdditions.

Any help on this one? Thanks

like image 536
Jason LAPIERRE Avatar asked Sep 19 '13 14:09

Jason LAPIERRE


1 Answers

To fix this issue, you must include "-ObjC" flag in "Other Linker Flags" found in your projects build settings.

UAirship library 3.x now makes use of Objective-C categories so this flag must be set to avoid the runtime exception.

Details on the issue can be found here:

https://developer.apple.com/library/mac/qa/qa1490/_index.html

Updated the docs:

http://docs.urbanairship.com/build/ios.html#build-settings http://docs.urbanairship.com/topic_guides/ios_migration.html#linker-flags

like image 100
ralepinski Avatar answered Oct 16 '22 11:10

ralepinski