setObjectForKey: object cannot be nil (key: data)'
See original GitHub issueWhen I try to pick from photo library I get the following error :
Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** setObjectForKey: object cannot be nil (key: data)’
When I look into ImagePickerManager.m, it seems that the following code is producing the error :
if (![[self.options objectForKey:@"noData"] boolValue]) {
NSString *dataString = [data base64EncodedStringWithOptions:0]; // base64 encoded image string
[self.response setObject:dataString forKey:@"data"];
}
But in my options I’m not setting “noData” to false. So it shouldn’t enter the if statement. If I comment out these lines, the error is not showing up anymore but the uri in my response object is linking to an inexistant picture.
Here is my options object :
var options = {
title: 'Sélectionnez une photo de profil',
storageOptions: {
path: 'images',
allowsEditing: true,
noData: true,
quality: 'medium',
},
};
Version
- react-native-image-crop-picker v0.26.3
- react-native v0.44.3
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:16
Top Results From Across the Web
'NSInvalidArgumentException', reason: '*** setObjectForKey ...
You are getting nil in the identifier. So please check it like this ... You cannot put nil values into a dictionary. It...
Read more >object cannot be nil (key: adTagUrl)' error in IMA iOS SDK
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: adTagUrl)'.
Read more >what is "[__NSDictionaryM setObject:forKey:]: object cannot be ...
It looks like you have a corrupt profile. Try "profiles list" in the Terminal. Show more Less. View in context.
Read more >Intermittent Crash - Object cannot be nil (key:ref_id)
Coding example for the question Intermittent Crash: - setObjectForKey: Object cannot be nil (key:ref_id)
Read more >[Solved] Error: object cannot be nil | B4X Programming Forum
Error occurred on line: 156 (IISApiCall) *** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: Data) Stack Trace: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue here. Only for picking from image library, not camera.
Crash occurred on
react-native-image-picker 2.3.4 ios 14.4.2 Hardware Model: iPhone13,4 (according to crash logs, which seems to be iphone 12 pro max)
last line seems to be the problem starting with “self.response”, but not sure how to fix it.
Reproduced on iPhone 11 Pro Max, 13.3.1