Friday, December 14, 2012

My Silly (and common) Mistake with the OAM Mobile and Social SDK on iOS

I recently created an iOS application using the OAM Mobile and Social SDK for iOS and got an error in my debugger output window:
2012-12-05 19:06:38.038 PiggyBank[24799:1303] -[__NSCFString OMJSONValue]: unrecognized selector sent to instance 0xb2be000
This error appeared after the Application Profile was downloaded and I couldn't figure out what I had done wrong.

Turns out I'd forgotten one step after adding the SDK bits to the XCode project - I had forgot to add the linker flags "-ObjC -all_load" under Build Settings.

To fix this click on the Project, then click the Target, then click the "Build Settings" tab and find the "Other Linker Flags" row. Edit it and add -ObjC -all_load to whatever's already there. Here's a screen shot:

Those flags are needed whenever a new message (function) will be passed to existing class without extending it. Inside the bits of the M&S SDK NSString doesn't have OMJSONValue but the SDK will pass OMJSONValue to NSString, so those flags are needed to make it work.

Of course this is documented in a block marked "Important:" but I missed it and I'm guessing if you found this blog post via Google you did too!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.