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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:36:30+00:00 2026-06-06T09:36:30+00:00

I am having an issue where NSDictionary is changing the values inside the <data>

  • 0

I am having an issue where NSDictionary is changing the values inside the <data> tag when I read the file in from disk. It also changes it when I save it back to disk.

I have a .plist file on disk that I read into a dictionary. This is the contents of the original ,plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Email</key>
    <string>user@email.com</string>
    <key>Name</key>
    <string>User</string>
    <key>Signature</key>
    <data>
    RBMIIr2dotiiKH5p6oTGsjqR7FSsmafZHpmJ7coO56eY8d5mBiVSZI5LCe7I3vGJk7WX
    0W/dLyAS+Es5fPlDhhSLNzesR1lNzMaTdfEKGU1FkvLE8bsZFJ7pK5gFc62e1NfP2eyU
    59SwWZDiqXumhUIOebhdZk5amtY7mN/McYM=
    </data>
</dict>
</plist>

I need the value of <data> so I can display it in an NSTextField, so I get the value like this:

NSData *key = [[NSDictionary dictionaryWithContentsOfFile:fileURLString] objectForKey:@"Signature"];

Now when I try to display the value of the key using NSLog(@"key: %@", key); it shows me this:

<44130822 bd9da2d8 a2287e69 ea84c6b2 3a91ec54 ac99a7d9 1e9989ed ca0ee7a7 98f1de66 06255264 8e4b09ee c8def189 93b597d1 6fdd2f20 12f84b39 7cf94386 148b3737 ac47594d ccc69375 f10a194d 4592f2c4 f1bb1914 9ee92b98 0573ad9e d4d7cfd9 ec94e7d4 b05990e2 a97ba685 420e79b8 5d664e5a 9ad63b98 dfcc7183>

So, how can I get the original <data> as an NSString in the same format that it shows in the .plist? and what is this (wrong) format directly above called?

NOTE: I have managed to get/store the original <data> value by extracting the text using componentsSeparatedByString, but it seems like a bad hack.

Now I need to save the .plist file back to disk so it matches the original .plist file, and that doesn’t work either. Here’s what I am doing:

NSString *sig = @"RBMIIr2dotiiKH5p6oTGsjqR7FSsmafZHpmJ7coO56eY8d5mBiVSZI5LCe7I3vGJk7WX0W/dLyAS+Es5fPlDhhSLNzesR1lNzMaTdfEKGU1FkvLE8bsZFJ7pK5gFc62e1NfP2eyU59SwWZDiqXumhUIOebhdZk5amtY7mN/McYM=";
const char *cString = [sig cStringUsingEncoding:NSASCIIStringEncoding];
NSData *d = [NSData dataWithBytes:cString length:strlen(cString)];
NSMutableDictionary *nameDetails=[[NSMutableDictionary alloc] init]; 
[nameDetails setValue:email forKey:@"Email"]; 
[nameDetails setValue:name forKey:@"Name"]; 
[nameDetails setValue:d forKey:@"Signature"]; 

...

[nameDetails writeToFile:fileURLString atomically:YES];

When I look at the new .plist file, the value of <data> is wrong. It should be the same as the value I passed for Signature key. This is the resulting (bad) .plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Email</key>
    <string>user@email.com</string>
    <key>Name</key>
    <string>User</string>
    <key>Signature</key>
    <data>
    UkJNSUlyMmRvdGlpS0g1cDZvVEdzanFSN0ZTc21hZlpIcG1KN2NvTzU2ZVk4ZDVtQmlW
    U1pJNUxDZTdJM3ZHSms3V1gwVy9kTHlBUytFczVmUGxEaGhTTE56ZXNSMWxOek1hVGRm
    RUtHVTFGa3ZMRThic1pGSjdwSzVnRmM2MmUxTmZQMmV5VTU5U3dXWkRpcVh1bWhVSU9l
    YmhkWms1YW10WTdtTi9NY1lNPQ==
    </data>
</dict>
</plist>

So, why does the value of Signature data, change when I save it back to a .plist?

  • 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-06T09:36:31+00:00Added an answer on June 6, 2026 at 9:36 am

    The value is the same. It’s just the representation that differs, just as 10, 10.000 and 0x0A are different representations of the same value. The XML property list stores the value with a Base64 encoding, while -[NSData description] (as printed by NSLog()) yields with a base 16 (a. k. a. hexadecimal) encoding. You’re looking for a way to Base64-encode an NSData object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having an issue properly accessing an NSDictionary built from Flickr data (the flickr.photosets.getPhotos
I am having issue when sending data from Service to Activity through Notification ,
Im having issue with mail sending In web.config file <mailSettings> <smtp from=xxxx@companyname.com> <network host=mail.authsmtp.com
Having a little issue with NSDictionary and sorting. I've read a few posts on
I am having an issue with NSDictionary returning null for an NSString even though
I am having an issue where I am trying to save whether a repeat
I'm quite new with Core Data, and I'm having an issue that I don't
Hey everyone :) I'm having a small issue and i'd love to hear from
I am having issue with opencv's Sobel edge detector. From its documentation it seems
I am having issue with loading test.xml and test.properties inside the same folder conf.

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.