Cordova plugin 1.1.0 iOS Crash


#1

Hi,
I have upgraded from 1.0.4 to 1.1.0, but the app keeps crashing with the following errors. On 1.0.4 everything works fine.

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid number value (NaN) in JSON write'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000109613c65 __exceptionPreprocess + 165
	1   libobjc.A.dylib                     0x000000010d541bb7 objc_exception_throw + 45
	2   CoreFoundation                      0x0000000109613b9d +[NSException raise:format:] + 205
	3   Foundation                          0x000000010d1dfc26 _writeJSONNumber + 748
	4   Foundation                          0x000000010d1dbefc _writeJSONValue + 477
	5   Foundation                          0x000000010d1e046f ___writeJSONObject_block_invoke + 220
	6   CoreFoundation                      0x0000000109553656 __65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102
	7   CoreFoundation                      0x000000010955355c -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 204
	8   Foundation                          0x000000010d1e0080 _writeJSONObject + 376
	9   Foundation                          0x000000010d1dbea6 _writeJSONValue + 391
	10  Foundation                          0x000000010d1dbcea -[_NSJSONWriter dataWithRootObject:options:error:] + 137
	11  Foundation                          0x000000010d1de76b +[NSJSONSerialization dataWithJSONObject:options:error:] + 345
	12  DivePlan                            0x00000001090efe44 +[CBLJSON dataWithJSONObject:options:error:] + 172
	13  DivePlan                            0x00000001090ff887 -[CBL_SQLiteViewStorage _emitKey:value:valueIsDoc:forSequence:] + 180
	14  DivePlan                            0x00000001090ff540 __39-[CBL_SQLiteViewStorage updateIndexes:]_block_invoke159 + 97
	15  DivePlan                            0x000000010906eb57 -[CBLJSViewCompiler emitWithKey:value:] + 38
	16  DivePlan                            0x000000010906eac6 __25-[CBLJSViewCompiler init]_block_invoke + 79
	17  CoreFoundation                      0x0000000109509dec __invoking___ + 140
	18  CoreFoundation                      0x0000000109509c42 -[NSInvocation invoke] + 290
	19  JavaScriptCore                      0x000000010cc66a61 _ZN3JSC24ObjCCallbackFunctionImpl4callEP9JSContextP13OpaqueJSValuemPKPKS3_PS6_ + 433
	20  JavaScriptCore                      0x000000010cc665d6 _ZN3JSCL34objCCallbackFunctionCallAsFunctionEPK15OpaqueJSContextP13OpaqueJSValueS4_mPKPKS3_PS6_ + 262
	21  JavaScriptCore                      0x000000010cc67775 _ZN3JSC19APICallbackFunction4callINS_20ObjCCallbackFunctionEEExPNS_9ExecStateE + 517
	22  JavaScriptCore                      0x000000010cb4038e _ZN3JSC14handleHostCallEPNS_9ExecStateENS_7JSValueENS_22CodeSpecializationKindE + 542
	23  JavaScriptCore                      0x000000010cb40542 linkFor + 162
	24  ???                                 0x00000239f823b3a4 0x0 + 2447999480740
	25  ???                                 0x00000239f8247730 0x0 + 2447999530800
	26  JavaScriptCore                      0x000000010cc33881 callToJavaScript + 311
	27  JavaScriptCore                      0x000000010cb17ea3 _ZN3JSC7JITCode7executeEPNS_2VMEPNS_14ProtoCallFrameE + 35
	28  JavaScriptCore                      0x000000010cafa8a0 _ZN3JSC11Interpreter11executeCallEPNS_9ExecStateEPNS_8JSObjectENS_8CallTypeERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 480
	29  JavaScriptCore                      0x000000010c936fde _ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE + 62
	30  JavaScriptCore                      0x000000010cbbb190 JSObjectCallAsFunction + 688
	31  JavaScriptCore                      0x000000010cbed93e -[JSValue callWithArguments:] + 286
	32  DivePlan                            0x000000010906e7b0 -[CBLJSFunction call:] + 357
	33  DivePlan                            0x000000010906ecb1 __49-[CBLJSViewCompiler compileMapFunction:language:]_block_invoke + 63
	34  DivePlan                            0x00000001090fed6e __39-[CBL_SQLiteViewStorage updateIndexes:]_block_invoke + 6605
	35  DivePlan                            0x00000001090f3d26 -[CBL_SQLiteStorage inTransaction:] + 100
	36  DivePlan                            0x00000001090fd26f -[CBL_SQLiteViewStorage updateIndexes:] + 225
	37  DivePlan                            0x000000010908933c -[CBLView updateIndexes:] + 78
	38  DivePlan                            0x0000000109089268 -[CBLView updateIndex] + 57
	39  DivePlan                            0x00000001091256ac -[CBL_Router(Handlers) queryDesignDoc:view:keys:] + 550
	40  DivePlan                            0x0000000109125ab3 -[CBL_Router(Handlers) do_GET:designDocID:view:] + 53
	41  DivePlan                            0x000000010911c5ca -[CBL_Router route] + 3367
	42  DivePlan                            0x000000010911cb61 -[CBL_Router run] + 859
	43  Foundation                          0x000000010d0f369a __NSThreadPerformPerform + 299
	44  CoreFoundation                      0x0000000109547431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	45  CoreFoundation                      0x000000010953d2fd __CFRunLoopDoSources0 + 269
	46  CoreFoundation                      0x000000010953c934 __CFRunLoopRun + 868
	47  CoreFoundation                      0x000000010953c366 CFRunLoopRunSpecific + 470
	48  Foundation                          0x000000010d0f7f92 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 275
	49  DivePlan                            0x0000000109074fe5 -[CBL_Server runServerThread] + 315
	50  Foundation                          0x000000010d0f609d __NSThread__main__ + 1194
	51  libsystem_pthread.dylib             0x000000010dcc005a _pthread_body + 131
	52  libsystem_pthread.dylib             0x000000010dcbffd7 _pthread_body + 0
	53  libsystem_pthread.dylib             0x000000010dcbd3ed thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Anybody has any idea on how to solve this?
Thanks
Luca


#2

The exception was thrown as the emitted value is not valid (JSON Valid). Can you check what emitted value you are emitting on the JavaScript side?


#3

It crashes the first time a POST is sent to the server:

coax.post([window.config.server, "_facebook_token"], registerData, function(err,info){
		cb(err,info)
    })

Where:

window.config.server = "http://lite.couchbase./"
registerData = {"remote_url":"http://62.149.229.141:4984/diveplanapp","email":"luca.palezza@gmail.com","access_token":"CAAHArxqPE7QBAPEmfa11rYGi8O1g8ZAbnjDUQZCA..........."}
err = null
info = {"email":"luca.palezza@gmail.com","ok":"registered"}

It crashes on the cb(err,info).


#4

Please see my other post on Android replication problem.
This should be related.
Thanks!
Luca