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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:45:06+00:00 2026-05-18T05:45:06+00:00

HI guys ~ this is how I download a plist from URL NSURLRequest *theRequest=[NSURLRequest

  • 0

HI guys ~

this is how I download a plist from URL

NSURLRequest *theRequest=[NSURLRequest requestWithURL:setDefaultPwdAndSnURL                                              cachePolicy:NSURLRequestUseProtocolCachePolicy
                         timeoutInterval:60.0];
NSData    *returnData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:nil];
NSString *listFile = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];

[listFile dataUsingEncoding:NSUTF8StringEncoding];
NSArray *plistData = [listFile propertyList];

and this is the result I got

plistdata is(
        {
        sn = 1;
        pwd = 123;
    }
)

I want to save it to a NSMutableDictionary

NSArray *paths      = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
 NSString *docPath    = [paths objectAtIndex:0];
 NSString *filePath   = [docPath stringByAppendingPathComponent:@"DevicePassword.plist"];
 NSMutableDictionary *dictread  = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];

 NSMutableDictionary *device_serialnumber = [NSMutableDictionary dictionaryWithObject:[[plistData objectAtIndex:0]valueForKey:@"sn"]
                      forKey:@"serial_number"];

 NSMutableDictionary *device_password = [NSMutableDictionary dictionaryWithObject:[[plistData objectAtIndex:0]  valueForKey:@"pwd"]
                   forKey:@"password"];
 [dictread addEntriesFromDictionary:device_serialnumber];
 [dictread addEntriesFromDictionary:device_password];               
 [dictread writeToFile:filePath atomically:YES];

but I Log(@"dictread is :%@",dictread);

got dictread : (NULL)

…….SO I PARESE A NULL THING TO dictread ????

Please help me to figure out this problem…. @_@

Many Great Thanks ~

NOTE:

I change some init value and Log it to check

NSMutableDictionary *device_serialnumber = [NSMutableDictionary dictionaryWithObject:@"123"
                      forKey:@"serial_number"];

 NSMutableDictionary *device_password = [NSMutableDictionary dictionaryWithObject:@"456"
                   forKey:@"password"];

I got two dictionary “device_serialnumber” and “device_password”

But “dictread” still (NULL)

Did I give a wrong function to add object to it ????

  • 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-18T05:45:07+00:00Added an answer on May 18, 2026 at 5:45 am

    dictread should not be initialized with initWithContentsOfFile: because the file does not yet exist. This will return nil for dictread if the file has an error (can’t read it as a dictionary) or the file is not there. Try using this initializer instead.

    NSMutableDictionary *dictread  = [[NSMutableDictionary alloc] initWithCapacity:[plistdata count]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey there guys and girls i have this code that should download a json
Hey guys this is my html code: <div class=nakupy> <li class=icn_kategorie><a href=#>Nákupy</a> <div class=sub_menu>
Hey guys this should be simple, I'm just not seeing it, I would like
Hey guys this is a bit of a homework puzzle I'm working on and
Guys check this website on FF and Chrome For some reason(s), jQuery isn't working
hey guys having this really simple problem but cant seem to figure out have
As outlined by this guys post, blocking IP's via PHP is pretty easy. However,
Sorry for the wall of text guys but this one requires expliaining, way too
So we are a few guys developing this product that is communicating with a
guys I know this question is very basic but I've met in few publications

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.