Search code examples
iosfacebookswiftnsuserdefaultsnsexception

Object cannot be nil for Un used NSUserDefaults key in project


Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: client_id)

In my current project (Swift) I am getting the above error, even when I haven't used that key anywhere in the project. I got the error after Facebook integration.

But the same key was used in my previous project. To resolve this problem, I cleaned my build and even uninstalled both previous and current app and then rerun build. Still facing error.

I searched for the key access client_id in all files, but I couldn't find it.


Solution

  • Actually your Info.plist file for facebook SDK integration is not properly configured and saved. For more detail refer FBSDK documentation Visit https://developers.facebook.com/docs/ios/getting-started