react-native-oauth
react-native-oauth copied to clipboard
DCTAuth error and app crashes
Getting this error and then the app crashes when trying to authorize.
If I "Erase all content and settings..." in the emulator, it works again for a while.
`2018-03-20 16:52:52.144700-0400 MyRNApp[18792:328054] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary
initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]' *** First throw call stack: ( 0 CoreFoundation 0x000000010b64612b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x0000000109f38f41 objc_exception_throw + 48 2 CoreFoundation 0x000000010b6860cc _CFThrowFormattedException + 194 3 CoreFoundation 0x000000010b55a951 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 321 4 CoreFoundation 0x000000010b55a7db +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59 5 MyRNApp 0x00000001079efbba __52-[OAuthManager makeRequest:urlOrPath:opts:callback:]_block_invoke + 1402 6 DCTAuth 0x000000010901c4ba __44-[DCTAuthRequest performRequestWithHandler:]_block_invoke_2 + 122 7 libdispatch.dylib 0x000000010be862f7 _dispatch_call_block_and_release + 12 8 libdispatch.dylib 0x000000010be8733d _dispatch_client_callout + 8 9 libdispatch.dylib 0x000000010be925f9 _dispatch_main_queue_callback_4CF + 628 10 CoreFoundation 0x000000010b608e39 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 11 CoreFoundation 0x000000010b5cd462 __CFRunLoopRun + 2402 12 CoreFoundation 0x000000010b5cc889 CFRunLoopRunSpecific + 409 13 GraphicsServices 0x00000001113a59c6 GSEventRunModal + 62 14 UIKit 0x000000010c1c05d6 UIApplicationMain + 159 15 MyRNApp 0x0000000107987a3f main + 111 16 libdyld.dylib 0x000000010bf03d81 start + 1 17 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) `
"dependencies": { "alt": "^0.18.6", "alt-container": "^1.1.1", "alt-utils": "^2.0.0", "impagination": "^1.0.0-alpha.3", "lodash": "^4.17.5", "moment": "^2.21.0", "native-base": "^2.3.9", "react": "^16.3.0-alpha.1", "react-global-configuration": "^1.2.1", "react-native": "0.54.2", "react-native-config": "^0.11.5", "react-native-hockeyapp": "^0.5.3", "react-native-navigation": "^1.1.407", "react-native-oauth": "git+ssh://[email protected]/exentrich/react-native-oauth.git#patch-1", "react-native-timeago": "^0.4.0", "react-native-vector-icons": "^4.5.0", "shitty-qs": "^1.0.1", "util": "^0.10.3", "yum": "^0.1.1" },
I receive this error when calling makeRequest with a valid authentication and the request fails. For example, if I have a API that accepts POST and I send a GET, it will 404. This crashes with the error you post above. If I change the method, it works.
if (err != nil) {
NSDictionary *errResp = @{
@"status": @"error",
@"msg": [NSString stringWithFormat:@"JSON parsing error: %@", [err localizedDescription]]
};
callback(@[errResp]);
} else {
NSDictionary *resp = @{
@"status": @(statusCode),
@"data": data
};
callback(@[[NSNull null], resp]);
}
In the happy path (non error) data is nil in my case and the app crashes.