I am new to IOS development and i have developed and build an app for IOS & Android in React Native and the app is fully working in Android. I have also installed the app on the iPhone simulator for testing, and after successfull build when the apps opens then it crashes and Xcode shows the stack of error.
Stack Trace
2018-03-26 17:18:59.537548+0530 VwWoocommerceAppMain[57934:681649] -[__NSDictionaryM length]: unrecognized selector sent to instance 0x60000023abc0
2018-03-26 17:18:59.555 [fatal][tid:com.facebook.react.AsyncLocalStorageQueue] Exception '-[__NSDictionaryM length]: unrecognized selector sent to instance 0x60000023abc0' was thrown while invoking multiSet on target AsyncLocalStorage with params (
(
(
cart,
{
}
)
),
5873
)
callstack: (
0 CoreFoundation 0x0000000103f8212b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000102874f41 objc_exception_throw + 48
2 CoreFoundation 0x0000000104003024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000103f04f78 ___forwarding___ + 1432
4 CoreFoundation 0x0000000103f04958 _CF_forwarding_prep_0 + 120
5 VwWoocommerceAppMain 0x0000000101956824 -[RCTAsyncLocalStorage _writeEntry:changedManifest:] + 258
6 VwWoocommerceAppMain 0x0000000101957104 -[RCTAsyncLocalStorage multiSet:callback:] + 436
7 CoreFoundation 0x0000000103f0636c __invoking___ + 140
8 CoreFoundation 0x0000000103f06240 -[NSInvocation invoke] + 320
9 CoreFoundation 0x0000000103f1ec26 -[NSInvocation invokeWithTarget:] + 54
10 VwWoocommerceAppMain 0x0000000101966929 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 602
11 VwWoocommerceAppMain 0x00000001019ac7a8 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 266
12 VwWoocommerceAppMain 0x00000001019ac522 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
13 libdispatch.dylib 0x0000000108bf32f7 _dispatch_call_block_and_release + 12
14 libdispatch.dylib 0x0000000108bf433d _dispatch_client_callout + 8
15 libdispatch.dylib 0x0000000108bfc855 _dispatch_queue_serial_drain + 1162
16 libdispatch.dylib 0x0000000108bfd1ea _dispatch_queue_invoke + 336
17 libdispatch.dylib 0x0000000108bf8f7c _dispatch_queue_override_invoke + 733
18 libdispatch.dylib 0x0000000108c00102 _dispatch_root_queue_drain + 772
19 libdispatch.dylib 0x0000000108bffda0 _dispatch_worker_thread3 + 132
20 libsystem_pthread.dylib 0x00000001091465a2 _pthread_wqthread + 1299
21 libsystem_pthread.dylib 0x000000010914607d start_wqthread + 13
)
2018-03-26 17:18:59.558030+0530 VwWoocommerceAppMain[57934:681649] Exception '-[__NSDictionaryM length]: unrecognized selector sent to instance 0x60000023abc0' was thrown while invoking multiSet on target AsyncLocalStorage with params (
(
(
cart,
{
}
)
),
5873
)
callstack: (
0 CoreFoundation 0x0000000103f8212b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000102874f41 objc_exception_throw + 48
2 CoreFoundation 0x0000000104003024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000103f04f78 ___forwarding___ + 1432
4 CoreFoundation 0x0000000103f04958 _CF_forwarding_prep_0 + 120
5 VwWoocommerceAppMain 0x0000000101956824 -[RCTAsyncLocalStorage _writeEntry:changedManifest:] + 258
6 VwWoocommerceAppMain 0x0000000101957104 -[RCTAsyncLocalStorage multiSet:callback:] + 436
7 CoreFoundation 0x0000000103f0636c __invoking___ + 140
8 CoreFoundation 0x0000000103f06240 -[NSInvocation invoke] + 320
9 CoreFoundation 0x0000000103f1ec26 -[NSInvocation invokeWithTarget:] + 54
10 VwWoocommerceAppMain 0x0000000101966929 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 602
11 VwWoocommerceAppMain 0x00000001019ac7a8 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 266
12 VwWoocommerceAppMain 0x00000001019ac522 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
13 libdispatch.dylib 0x0000000108bf32f7 _dispatch_call_block_and_release + 12
14 libdispatch.dylib 0x0000000108bf433d _dispatch_client_callout + 8
15 libdispatch.dylib 0x0000000108bfc855 _dispatch_queue_serial_drain + 1162
16 libdispatch.dylib 0x0000000108bfd1ea _dispatch_queue_invoke + 336
17 libdispatch.dylib 0x0000000108bf8f7c _dispatch_queue_override_invoke + 733
18 libdispatch.dylib 0x0000000108c00102 _dispatch_root_queue_drain + 772
19 libdispatch.dylib 0x0000000108bffda0 _dispatch_worker_thread3 + 132
20 libsystem_pthread.dylib 0x00000001091465a2 _pthread_wqthread + 1299
21 libsystem_pthread.dylib 0x000000010914607d start_wqthread + 13
)
2018-03-26 17:18:59.561965+0530 VwWoocommerceAppMain[57934:681649] *** Terminating app due to uncaught exception 'RCTFatalException: Exception '-[__NSDictionaryM length]: unrecognized selector sent to instance 0x60000023abc0' was thrown while invoking multiSet on target AsyncLocalStorage with params (
(
(
cart,
{
}
)
),
5873
)
callstack: (
0 CoreFoundation 0x0000000103f8212b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000102874f41 objc_exception_throw + 48
2 CoreFoundation 0x0000000104003024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000103f04f78 ___forwarding___ + 1432
4 CoreFoundation 0x0000000103f04958 _CF_forwarding_prep_0 + 120
5 VwWoocommerceAppMain 0x0000000101956824 -[RCTAsyncLocalStorage _writeEntry:changedManifest:] + 258
6 VwWoocommerceAppMain 0x0000000101957104 -[RCTAsyncLocalStorage multiSet:callback:] + 436
7 CoreFoundation 0x0000000103f0636c __invoking___ + 140
8 CoreFoundation 0x0000000103f06240 -[NSInvocation invoke] + 320
9 CoreFoundation 0x0000000103f1ec26 -[NSInvocation invokeWithTarget:] + 54
10 VwWoocommerceAppMain 0x0000000101966929 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 602
11 VwWoocommerceAppMain 0x00000001019ac7a8 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 266
12 VwWoocommerceAppMain 0x00000001019ac522 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
13 libdispatch.dylib 0x0000000108bf32f7 _dispatch_call_block_and_release + 12
14 libdispatch.dylib 0x0000000108bf433d _dispatch_client_callout + 8
15 libdispatch.dylib 0x0000000108bfc855 _dispatch_queue_serial_drain + 1162
16 libdispatch.dylib 0x0000000108bfd1ea _dispatch_queue_invoke + 336
17 libdispatch.dylib 0x0000000108bf8f7c _dispatch_queue_override_invoke + 733
18 libdispatch.dylib 0x0000000108c00102 _dispatch_root_queue_drain + 772
19 libdispatch.dylib 0x0000000108bffda0 _dispatch_worker_thread3 + 132
20 libsystem_pthread.dylib 0x00000001091465a2 _pthread_wqthread + 1299
21 libsystem_pthread.dylib 0x000000010914607d start_wqthread + 13
)', reason: 'Exception '-[__NSDictionaryM length]: unrecognized selector sent to instanc...'
*** First throw call stack:
(
0 CoreFoundation 0x0000000103f8212b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000102874f41 objc_exception_throw + 48
2 VwWoocommerceAppMain 0x0000000101953a22 RCTFormatError + 0
3 VwWoocommerceAppMain 0x00000001019ac9bc _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 798
4 VwWoocommerceAppMain 0x00000001019ac522 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
5 libdispatch.dylib 0x0000000108bf32f7 _dispatch_call_block_and_release + 12
6 libdispatch.dylib 0x0000000108bf433d _dispatch_client_callout + 8
7 libdispatch.dylib 0x0000000108bfc855 _dispatch_queue_serial_drain + 1162
8 libdispatch.dylib 0x0000000108bfd1ea _dispatch_queue_invoke + 336
9 libdispatch.dylib 0x0000000108bf8f7c _dispatch_queue_override_invoke + 733
10 libdispatch.dylib 0x0000000108c00102 _dispatch_root_queue_drain + 772
11 libdispatch.dylib 0x0000000108bffda0 _dispatch_worker_thread3 + 132
12 libsystem_pthread.dylib 0x00000001091465a2 _pthread_wqthread + 1299
13 libsystem_pthread.dylib 0x000000010914607d start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
If anyone knows please help.
While saving data in AsyncStorage always use JSON.stringify irrespective of your what your data is:
AsyncStorage.setItem('#key', 'will work on Android'))
AsyncStorage.setItem('#key', JSON.stringify('will work on both iOS and Android'))
I've ran across the same issue. The problem is that iOS is looking for a function named length() on the mutable dictionary, but NSDictionaryM uses count(). A work around is to stringify your object so it doesn't use a mutable dictionary.
The Android code works fine, the object is stored and there isn't a function pointer to the wrong function.
In my project I was trying to persist session keys using asyncstorage. I had a wrapper called storage. I'm new to react too, so I might not be doing best practices here.
import {storage, keys} from './storage';
storage.store(keys.session, res.data).then(()=>{}).catch(()=>{}); //Will crash in iOS, but work fine in Android
storage.store(keys.session, JSON.stringify(res.data)).then(()=>{}).catch(()=>{}); //Will work fine on both.
Here is the full method:
getSession(email, password){
Network.login(email, password)
.then((res) => {
if(res.code == 1){
storage.store(keys.session, JSON.stringify(res.data)).then(()=>{
//Hurray
}).catch((error)=>{
throw new Error(error);
});
store.dispatch({
type: actions.SESSION,
session: res.data
});
return res.data;
}else{
throw new Error(res.data);
}
})
.catch((err) => {
this.setState({error: err.message});
});
}
Please avoid an empty object in async storage in ios, that will resolve your issue
For IOS you need to enter the empty object on the initailize.
Can use below code to solve:
AsyncStorage.setItem('#key', JSON.stringify({}))
My issue was with MapboxGL tileUrlTemplates being an array with false inside.
The error message was much better when running on Android, just a tip.
when I use Korean language with Firestore.
Occur exception like this...
how can I solve it?
FAILED: Read document has key () instead of expected key ().'
*** First throw call stack:
(
0 CoreFoundation 0x00000001180d81ab __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000011776df41 objc_exception_throw + 48
2 CoreFoundation 0x00000001180dd372 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000117212089 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 dayView 0x000000010d69e3ea -[FSTLevelDBRemoteDocumentCache decodedMaybeDocument:withKey:] + 754
5 dayView 0x000000010d69ddcf -[FSTLevelDBRemoteDocumentCache documentsMatchingQuery:] + 488
6 dayView 0x000000010d69ec69 -[FSTLocalDocumentsView documentsMatchingCollectionQuery:] + 171
7 dayView 0x000000010d69ea6f -[FSTLocalDocumentsView documentsMatchingQuery:] + 210
8 dayView 0x000000010d6a3f01 -[FSTLocalStore executeQuery:] + 79
9 dayView 0x000000010d68946c -[FSTSyncEngine listenToQuery:] + 273
10 dayView 0x000000010d68132d -[FSTEventManager addListener:] + 469
11 dayView 0x000000010d6831da __64-[FSTFirestoreClient listenToQuery:options:viewSnapshotHandler:]_block_invoke + 62
12 libdispatch.dylib 0x00000001196ca3f7 _dispatch_call_block_and_release + 12
13 libdispatch.dylib 0x00000001196cb43c _dispatch_client_callout + 8
14 libdispatch.dylib 0x00000001196d395b _dispatch_queue_serial_drain + 1162
15 libdispatch.dylib 0x00000001196d42df _dispatch_queue_invoke + 336
16 libdispatch.dylib 0x00000001196d007d _dispatch_queue_override_invoke + 733
17 libdispatch.dylib 0x00000001196d71f9 _dispatch_root_queue_drain + 772
18 libdispatch.dylib 0x00000001196d6e97 _dispatch_worker_thread3 + 132
19 libsystem_pthread.dylib 0x0000000119b931ca _pthread_wqthread + 1387
20 libsystem_pthread.dylib 0x0000000119b92c4d start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Here is the log in Xcode
2017-09-05 11:12:06.477 AppDemo[5064:29077] -[NSTaggedPointerString unsignedIntValue]: unrecognized selector sent to instance 0xa303036383231327
2017-09-05 11:12:06.642 AppDemo[5064:29077] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString unsignedIntValue]: unrecognized selector sent to instance 0xa303036383231327'
*** First throw call stack:
(
0 CoreFoundation 0x0000000110564b0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010f41a141 objc_exception_throw + 48
2 CoreFoundation 0x00000001105d4134 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00000001104eb840 ___forwarding___ + 1024
4 CoreFoundation 0x00000001104eb3b8 _CF_forwarding_prep_0 + 120
5 AppDemo 0x000000010e7cfc94 -[RCTMultipartStreamReader emitProgress:contentLength:final:callback:] + 244
6 AppDemo 0x000000010e7d048a -[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:] + 1610
7 AppDemo 0x000000010e81fdbc -[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:] + 444
8 CFNetwork 0x000000010ffc4c51 __88-[NSURLSession delegate_streamTask:didBecomeInputStream:outputStream:completionHandler:]_block_invoke + 51
9 Foundation 0x000000010ef243b7 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
10 Foundation 0x000000010ef240bb -[NSBlockOperation main] + 101
11 Foundation 0x000000010ef22877 -[__NSOperationInternal _start:] + 627
12 Foundation 0x000000010ef1e5fc __NSOQSchedule_f + 198
13 libdispatch.dylib 0x000000011424605c _dispatch_client_callout + 8
14 libdispatch.dylib 0x000000011422494f _dispatch_queue_serial_drain + 221
15 libdispatch.dylib 0x0000000114225669 _dispatch_queue_invoke + 1084
16 libdispatch.dylib 0x0000000114227ec4 _dispatch_root_queue_drain + 634
17 libdispatch.dylib 0x0000000114227bef _dispatch_worker_thread3 + 123
18 libsystem_pthread.dylib 0x00000001145dd712 _pthread_wqthread + 1299
19 libsystem_pthread.dylib 0x00000001145dd1ed start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I am getting the following crash. I am using Layer messaging sdk and on it Atlas messenger sample. This issue is coming sometime when i am navigating from conversationListView to conversationView. Is there any solution to it.
(
0 CoreFoundation 0x000000010ba10b0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010b47c141 objc_exception_throw + 48
2 CoreFoundation 0x000000010ba14cf2 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010b0163b6 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x000000010a03053d -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:] + 15364
5 UIKit 0x000000010a039259 -[UICollectionView _endUpdatesWithInvalidationContext:tentativelyForReordering:animator:] + 71
6 UIKit 0x000000010a0395a0 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:animator:] + 437
7 UIKit 0x000000010a0393c8 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:] + 91
8 UIKit 0x000000010a03934a -[UICollectionView _performBatchUpdates:completion:invalidationContext:] + 74
9 UIKit 0x000000010a03929f -[UICollectionView performBatchUpdates:completion:] + 53
10 Atlas 0x0000000104ed30ce -[ATLConversationViewController queryControllerDidChangeContent:] + 1134
11 LayerKit 0x0000000106bb2b0a __76-[LYRQueryController updateWithObjectIdentifiers:changedObjectsIdentifiers:]_block_invoke.239 + 74
12 libdispatch.dylib 0x000000010cde905c _dispatch_client_callout + 8
13 libdispatch.dylib 0x000000010cdcc0f8 _dispatch_barrier_sync_f_slow_invoke + 579
14 libdispatch.dylib 0x000000010cde905c _dispatch_client_callout + 8
15 libdispatch.dylib 0x000000010cdca40b _dispatch_main_queue_callback_4CF + 411
16 CoreFoundation 0x000000010b9d5909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
17 CoreFoundation 0x000000010b99bae4 __CFRunLoopRun + 2164
18 CoreFoundation 0x000000010b99b016 CFRunLoopRunSpecific + 406
19 GraphicsServices 0x000000010de41a24 GSEventRunModal + 62
20 UIKit 0x00000001096e50d4 UIApplicationMain + 159
21 SampleApp 0x000000010439f797 main + 55
22 libdyld.dylib 0x00000001095c865d start + 1
)
Error Description:
[ATLConversationCollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3600.7.47/UICollectionView.m:5765
2017-06-23 11:33:27.473137+0530 SampleApp[1815:546610] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the collection view after the update (3) must be equal to the number of sections contained in the collection view before the update (3), plus or minus the number of sections inserted or deleted (1 inserted, 0 deleted).'
*** First throw call stack:
(0x19207afd8 0x190adc538 0x19207aeac 0x192b12710 0x198ab47cc 0x198ab865c 0x198ab893c 0x198ab879c 0x198ab8720 0x198380558 0x10099f14c 0x101eb12b4 0x105039a10 0x10504a5e4 0x105039a10 0x10503eb78 0x1920290c0 0x192026cdc 0x191f56d94 0x1939c0074 0x19820f130 0x10010b454 0x190f6559c)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
i'm using the firebase simpleLogin for facebook login, but there seem to be an issue. i'm not sure how to debug this. What seem to be the issue here?
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
0 CoreFoundation 0x02c331e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x029b28e5 objc_exception_throw + 44
2 CoreFoundation 0x02bf9376 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 390
3 CoreFoundation 0x02c26c29 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 73
4 app 0x000257b5 ParseUserData + 373
5 app 0x000982a6 __38-[LoginViewController actionFacebook:]_block_invoke + 358
6 app 0x00148647 __89-[FirebaseSimpleLogin loginToFacebookAppWithId:permissions:audience:withCompletionBlock:]_block_invoke245 + 83
7 app 0x00149068 __86-[FirebaseSimpleLogin requestFacebookAccountWithPermissions:audience:appId:withBlock:]_block_invoke + 245
8 Accounts 0x012cc91f __69-[ACAccountStore requestAccessToAccountsWithType:options:completion:]_block_invoke_2 + 85
9 libdispatch.dylib 0x02f917b8 _dispatch_call_block_and_release + 15
10 libdispatch.dylib 0x02fa64d0 _dispatch_client_callout + 14
11 libdispatch.dylib 0x02f92fe0 _dispatch_async_redirect_invoke + 202
12 libdispatch.dylib 0x02fa64d0 _dispatch_client_callout + 14
13 libdispatch.dylib 0x02f94eb7 _dispatch_root_queue_drain + 291
14 libdispatch.dylib 0x02f95127 _dispatch_worker_thread2 + 39
15 libsystem_pthread.dylib 0x032d5dab _pthread_wqthread + 336
16 libsystem_pthread.dylib 0x032d9cce start_wqthread + 30
)