Getting data from NSUSerDefaults and Passing has parameter application get crashed
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[loginController showView:[prefs objectForKey:kSavedUserName] :[prefs objectForKey:kSavedUserPassword]];
// [loginController showView:@"abcd03@gmail.com" Password:@"apple”];
When i am printing those value in NSLog [prefs objectForKey:kSavedUserPassword] is showing value. password and [prefs objectForKey:kSavedUserName] user name.
If I hard-coded my requirement parameters it working fine.
My crash log is
unrecognized selector sent to instance 0x5ccc2d0
2011-07-21 14:32:27.721 iShop[3815:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LoginViewController showView::]: unrecognized selector sent to instance 0x5ccc2d0'
*** Call stack at first throw:
Your
loginControllerdoesn’t respond to theshowView::message, that’s why your app crashes. Check the method name inLoginViewController, and correct it. I think there is no matter withNSUserDefaults.Also try to avoid unamed parameters in selectors, always name them, to avoid problems.