City airship crashes on takeoff call

Upgrading to UrbanAirship 3.0.0 from Xcode 5.0, I get an error when calling this code:

[UAirship takeOff:config]; 

Mistake

 +[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 is not like setting the "inProduction" key to "YES" in AirshipConfig.plist , which makes sense like a call to takeOff: populates the UAirShip instance. This seems to be related to the NSJSONSerialization+UAAdditions .

Any help on this? Thanks

+8
ios objective-c ios7 nsjsonserialization
source share
5 answers

To fix this problem, you must include the “-ObjC” flag in the “Other linker flags” found in your project build settings.

The UAirship 3.x library now uses Objective-C categories, so this flag must be set to throw a run-time exception.

Details on this issue can be found here:

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

Updated documents:

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

+16
source share

No seam occurs with the source: https://github.com/urbanairship/ios-library

0
source share

You should have included both libraries:

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

You must use any of the libraries for the corresponding iOS

0
source share

Looking at the various solutions, it turns out that this fixes the problem:

• Download sources from https://github.com/urbanairship/ios-library directly to the application folder (do not accept .zip on your website)

• Drag and drop the Airship folder into your project (do not use AirshipLib)

Do not bind to any of libUAirship-3.0.0.a or libUAirship-iOS5-3.0.0.a

• Boom. He works.

Hope this helps some others who want to fix it for ages.

0
source share

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

In addition, if this does not compile, there is another option

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

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

0
source share

All Articles