Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8983895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:57:20+00:00 2026-06-15T20:57:20+00:00

I have a plist with Array title and item0 , item1 , item2 is

  • 0

I have a plist with Array title and item0,item1,item2 is dictionary to store title and password of my app.now i want to check for signin process

eneter here
now i Want to check for pass and items should be matched when i press submit button to login.i Tried the below code but xcode crashes

-(void)authenticateCredentials 
{ 
NSMutableArray *plistArray = [NSMutableArray arrayWithArray:[self readFromPlist]]; 

for (int i = 0; i< [plistArray count]; i++) 
{ 
 if ([[[plistArray   objectAtIndex:i]objectForKey:@"pass"]isEqualToString:emailTextFeild.text] && [[[plistArray objectAtIndex:i]objectForKey:@"title"]isEqualToString:passwordTextFeild.text]) 
{ 
NSLog(@"Correct credentials"); 
 return;
} 
   NSLog(@"INCorrect credentials"); 
 } 
 }

and

-(NSArray*)readFromPlist
 {
   NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
  NSUserDomainMask, YES); 
  NSString *documentsDirectory = [documentPaths objectAtIndex:0];
 NSString *documentPlistPath = [documentsDirectory stringByAppendingPathComponent:@"XYZ.plist"];

   NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:documentPlistPath];

   NSArray *valueArray = [dict objectForKey:@"title"];

   return valueArray;

 }

the xcode gets crashs ..please check in -(void)authenticateCredentials where i am incorrect?

AND
Crash when I select the submit button,Its wont give any output correct or incorrect in nslog and Xcode crash then , with errorr

 2012-12-14 12:10:45.142 NavTutorial[1661:f803] emailEntry: hi@gmail.com.com
2012-12-14 12:10:45.145 NavTutorial[1661:f803] passwordEntry: hellohello
2012-12-14 12:10:45.153 NavTutorial[1661:f803] -[__NSCFConstantString objectForKey:]:   unrecognized selector sent to instance 0x1568cd8
2012-12-14 12:10:45.155 NavTutorial[1661:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString objectForKey:]:     unrecognized selector sent to instance 0x1568cd8'
 *** First throw call stack:
(0x14d7052 0x11c2d0a 0x14d8ced 0x143df00 0x143dce2 0x3981 0x14d8ec9 0x3735c2 0x37355a 0x418b76 0x41903f 0x417e22 0x39893f 0x398c56 0x37f384 0x372aa9 0x1bcdfa9 0x14ab1c5 0x1410022 0x140e90a 0x140ddb4 0x140dccb 0x1bcc879 0x1bcc93e 0x370a9b 0x211d 0x2095 0x1)
terminate called throwing an exception

and
two days ago this same code worked fine

and if i put Breakpoint for IF condition and later if fails just after if condition.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:57:21+00:00Added an answer on June 15, 2026 at 8:57 pm

    Modify your authenticateCredentials as shown below and check if it is working. If it is showing an error message as Error! Not a dictionary, you need to check if your plist is having correct structure. Mostly your [objDict objectForKey:@"pass"] is returning a different data type.

    - (void)authenticateCredentials {
        NSMutableArray *plistArray = [NSMutableArray arrayWithArray:[self readFromPlist]];
    
        for (int i = 0; i< [plistArray count]; i++)
        {
            id object = [plistArray objectAtIndex:i];
    
            if ([object isKindOfClass:[NSDictionary class]]) {
                NSDictionary *objDict = (NSDictionary *)object;
    
                if ([[objDict objectForKey:@"pass"] isEqualToString:emailTextFeild.text] && [[objDict objectForKey:@"title"] isEqualToString:passwordTextFeild.text])
                {
                    NSLog(@"Correct credentials");
                    return;
                }
                NSLog(@"INCorrect credentials");
            } else {
                 NSLog(@"Error! Not a dictionary");
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In an app I have a plist : root ---> dictionary cell ----> array
I have a plist file which is an array of dictionaries. Where each dictionary
I have a plist in my app that contain rows in the Root Dictionary
I have a .plist file containing array and dictionaries. I want to convert this
I have the following plist: <plist version=1.0> <array> <dict> <key>description</key> <string>Dodge Viper</string> <key>title</key> <string>Bil</string>
I have a plist (array of dictionaries) which populates a table view and works
I have a plist which contains an array of NSDictionary 's which represent a
i have a plist that's at its root an array with dictonaries inside it.
I have a plist uploaded on a server. When I log the array with:
I have a plist on my server that I provide for an app. On

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.