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

The Archive Base Latest Questions

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

I have a page that takes in a zip code from a user, sends

  • 0

I have a page that takes in a zip code from a user, sends that data to a php page, then retrieves the data via JSON. This page is throwing an error that says:

2011-12-27 15:17:49.919 BusinessManager[3595:20b] * Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘* -[NSConcreteData isFileURL]: unrecognized selector sent to instance 0x4751490′

The code is:

    - (id)initWithNibName:(NSString *)SearchZip bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:SearchZip bundle:nibBundleOrNil]) {
    // Custom initialization
}
return self;
}


- (IBAction) searchzip: (id) sender
{
NSString *post =[NSString stringWithFormat:@"zipcode=%@",zipField.text];

NSString *hostStr =    @"https://www.mysite.com/searchzip.php?";
hostStr = [hostStr stringByAppendingString:post];
NSData *dataURL =  [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr ]];

NSString *jsonData = [[NSString alloc] initWithContentsOfURL:dataURL];


self.zipArray = [jsonData JSONValue]; 

[jsonData release];
}
- (void)viewDidLoad {
[super viewDidLoad];

}



- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [zipArray count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:  (NSIndexPath *)indexPath {
 NSDictionary *infoDictionary = [self.zipArray objectAtIndex:indexPath.row];
 static NSString *Prospects = @"agencyname";

 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Prospects];
 if (cell == nil) {
 cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:Prospects]  autorelease];
 }

 // setting the text
 cell.text = [infoDictionary objectForKey:@"agencyname"];   
 self.navigationItem.title = @"Zip Search";

 // Set up the cell
 return cell;

 }
  • 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-27T19:42:32+00:00Added an answer on May 27, 2026 at 7:42 pm

    You’re attempting to pass an instance of NSData into -initWithContentsOfURL: to create the jsonData instance of NSString.

    I’m about to pimp your method. Notice that I’ve removed creating an NSData object altogether and renamed variables to be more clear.

    - (IBAction)searchzip:(id)sender
    {
        NSString *post = [NSString stringWithFormat:@"zipcode=%@", zipField.text];
        NSString *hostString = @"https://www.mysite.com/searchzip.php?";
    
        // Append string and add percent escapes
        hostString = [[hostString stringByAppendingString:post] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSURL *hostURL = [NSURL URLWithString:hostString];
        NSString *jsonString = [[NSString alloc] initWithContentsOfURL:hostURL];
        self.zipArray = [jsonString JSONValue]; 
        [jsonString release];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page (index.php) that takes a GET variable from the URL and
I have a php page that takes in a bunch of url parameters and
I have a page with a Print link that takes the user to a
I have a page that takes a GET variable, q from the URL using
I have a ASP.NET page that takes some key, value data and a HttpFileCollection
I have a php page that takes 2.8 seconds to render. The page contains
How can i have a link on a page that takes the user to
I have a .net web service that takes some xml data. From within the
I have a page that takes data entered in a previous page and inputs
I have a page that takes a few minutes to run. When I set

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.