Question

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

Was it helpful?

Solution

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

OTHER TIPS

Doesn't seam to be happening with the source: https://github.com/urbanairship/ios-library

You must have included both the libraries:

  • libUAirship-3.0.0.a
  • libUAirship-iOS5-3.0.0.a

You have to use either of the library for respective iOS

After looking at different solutions, it turns out that this fixes the issue:

• Download sources from https://github.com/urbanairship/ios-library directly into your App folder (don't take .zip given on their website)

• Drag & drop the Airship folder in your Project (do not use the AirshipLib one)

Don't link any of the libUAirship-3.0.0.a or libUAirship-iOS5-3.0.0.a

• Boom. It's working.

Hope it'll help some others out there looking to fix this for ages.

Just to add, my problem was that I added -ObjC flag to the project, and it should be added to the target settings.

Also, if that does not compile, there is another option

-Wl,-force_load,<PathToYourLib>/libUAirship-4.0.0.a    

Also should be added to the target. Fill the real path to your lib instead of <PathToYourLib>.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top