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

  • Home
  • SEARCH
  • 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 6850581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:08:32+00:00 2026-05-27T01:08:32+00:00

I just found an interesting problem with my app. In the app I am

  • 0

I just found an interesting problem with my app. In the app I am saving the user’s user name and password to the keychain.

keychainWrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"MyLoginPassword" accessGroup:nil];

[keychainWrapper setObject:usernameField.text forKey:(id)kSecAttrAccount];
[keychainWrapper setObject:passwordField.text forKey:(id)kSecValueData];

When this code is run in Debug it seems to work just fine. It updates each time and I can later retrieve the items from the keychain. When it is run in Distribution however the keychain never gets updated. I have verified that yes these lines of code are hit in both builds. I am using Xcode 4.2 with the iOS5 SDK and running the app on an iPad 2 with iOS5 installed.

  • 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-05-27T01:08:32+00:00Added an answer on May 27, 2026 at 1:08 am

    I also had this problem, and it took me forever to figure out

    There is a version of “KeychainWrapper” floating around that has it’s SecItemUpdate within an NSAssert (among other things).

    Whoever did this is a moron!, when building for release/distribution every NSAssert is nullified, meaning that code doesn’t even get run.

    For example:

    NSAssert(SecItemUpdate((CFDictionaryRef)updateItem, (CFDictionaryRef)tempCheck), @"Couldn't update the Keychain Item." );
    

    Needs to become

    OSStatus status = SecItemUpdate((CFDictionaryRef)updateItem, (CFDictionaryRef)tempCheck);
    NSAssert(status == noErr, @"Couldn't update the Keychain Item." );
    

    Notice how the actual SecItemUpdate is moved outside the NSAssert, and instead the result is checked

    Important note:
    Attempting to update a value for kSecValueData, without also specifying a value for kSecAttrAccount, will cause the assertion to fail as well. So, if your intent is to store a single string of sensitive data (such as a list of credit card numbers), be sure to store some “account name” text in the kSecAttrAccount attribute, like so:

    static NSString* kCardListXML = @"cardListXML";
    static NSString* cardListAccountName = @"cardListAccount";
    
    -(void)setCardListXML:(NSString*)xml {
      KeychainItemWrapper* wrapper =
        [[KeychainItemWrapper alloc] initWithIdentifier:kCardListXML accessGroup:nil];
      [wrapper setObject:cardListAccountName forKey:(id)CFBridgingRelease(kSecAttrAccount)];
      [wrapper setObject:xml forKey:(id)CFBridgingRelease(kSecValueData)];
    }    
    
    -(NSString*)getCardListXML {
      KeychainItemWrapper* wrapper =
        [[KeychainItemWrapper alloc] initWithIdentifier:kCardListXML accessGroup:nil];
      [wrapper setObject:cardListAccountName forKey:(id)CFBridgingRelease(kSecAttrAccount)];
      return [wrapper objectForKey:CFBridgingRelease(kSecValueData)];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just found an interesting problem between translating some data: VB.NET: CByte(4) << 8
I was looking through a code tutorial just now, and found something interesting --
A .Net 4.0 app keeps crashing for a user, but just for him, I
I just found an interesting situation. Suppose you have some SwingWorker (I've made this
I just found an interesting article on ajaxian.com. the article is http://blog.dynatrace.com/2011/03/22/testing-and-optimizing-single-page-web-2-0ajax-applications-why-best-practices-alone-dont-work-any-more/ i wonder
I have an interesting problem. My app runs fine on the iphone 4.2 simulator,
Having an interesting little problem with my iPhone app. I have a view with
Just found this out, so i am answering my own question :) Use a
Just found out that the video output of the iPad is not a system
I just found /n softwares free Powershell NetCmdlets, and after playing with them I

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.