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 8842277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:55:03+00:00 2026-06-14T10:55:03+00:00

Following a piece of code I am using to get the password stored in

  • 0

Following a piece of code I am using to get the password stored in my custom Keychain

-(OSStatus *)getPasswordFromKeyChain:(NSString *)username{
OSStatus status;

[self createKeyChainIfNotExists];

const char *cService_name = "Mac Google Analytics App";
UInt32 service_length = strlen(cService_name);

const char *cUser_name = [username cStringUsingEncoding:NSUTF8StringEncoding];
UInt32 username_length = strlen(cUser_name);

void *passwordData = nil; 
SecKeychainItemRef itemRef = nil;
UInt32 passwordLength = nil;

status = SecKeychainFindGenericPassword(
                                        mSecKeychainRef,            // default keychain
                                        service_length,  // length of service name
                                        cService_name,    // service name
                                        username_length,// length of account name
                                        cUser_name,    // account name
                                        &passwordLength,  // length of password
                                        passwordData,        // pointer to password data
                                        NULL             // the item reference
                                        );

return status;
}

I wonder what is wrong in this code, as the it never comes out of this call:

SecKeychainFindGenericPassword

It’s pointed to the error shown here.

  • 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-14T10:55:04+00:00Added an answer on June 14, 2026 at 10:55 am

    Pass null for the default keychain, and you need a pointer to the passwordData. That should at least get you a return status to tell if the strings are correct for your service & account.

        status = SecKeychainFindGenericPassword(NULL,            // default keychain
                                                service_length,  // length of service name
                                                cService_name,    // service name
                                                username_length,// length of account name
                                                cUser_name,    // account name
                                                &passwordLength,  // length of password
                                                &passwordData,        // pointer to password data
                                                NULL             // the item reference
                                                );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following piece of code to get all windows: CFArrayRef windows =
I'm using the following piece of code to get the content of a webpage
I am using the following piece of code to get results from DB as
I'm using the following piece of code to pull a stock price from yahoo
I'm using the following piece of code to login a user via Ajax. //Capture
I've recently been using the following piece of code to limit my 2nd Date
I'm using jQuery with rails and have the following piece of code $('#related').html(<%= render
In the following piece of JavaScript code, i'm executing GetData.php using AJAX. However, when
I'm using the following piece of code and under some mysterious circumstances the result
I am using the Following piece of code if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *picker

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.