NSInvalidArgumentException', reason: '[__NSCFString JSONObject]' with PhoneGap Camera

398 views Asked by At

I have been working with PhoneGap to access the camera, which works locally when built to the iPhone, but when I upload to TestFlight, the same method fails and gives me the following:

'NSInvalidArgumentException', reason: '[__NSCFString JSONObject]'

The arguments that are being passed are as follows:

[["Camera1856949628","Camera","takePicture",[25,0,1,100,100,1,0,false,false,false,null,0]]]

From what I gather its failing in CDVJSON.m when converting an NSString to JSONObject which in turn is an NSArray.

Any suggestions on what might be causing this?

1

There are 1 answers

0
kilik52 On

Because your code don't use the JSONObject until runtime. So CDVJSON.m didn't linked in the app.

Fixed the issue by adding "Other Linker Flags: -all_load" in your project. As suggested by this answer: https://stackoverflow.com/a/17581430/2570865