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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:54:13+00:00 2026-05-31T09:54:13+00:00

I want to send json service when the user search text on searchbar. Here

  • 0

I want to send json service when the user search text on searchbar. Here the issue is that I return null value of NSData object, what the issue is here? If I define the same url which I print in console that works but what’s the issue here?

-(void)doIt{

    NSURL *url = [NSURL URLWithString:weburls];
    NSData *data =[NSData dataWithContentsOfURL:url];
    [self getData:data];
}

If I will write like that then it works, but I want to call the service on the searchbar event but there is a problem

NSString *weburl = [NSString stringWithFormat:@"%@%@",
@"http://192.168.1.196/ravi/iphonephp?mname=",searchText];
NSLog(@"%@",weburl);

NSURL *url = [NSURL URLWithString:weburl];
NSLog(@"the url is : %@",url);

NSError *error;

NSData *data =[NSData dataWithContentsOfURL:url options:nil error:&error];
NSLog(@"Data is :%@",data);

NSLog(@"the Error massage is : %@",error);
[self getData:data];

Gives me console value like

customCellDemo[1553:f803] the url is : http://192.168.1.196/ravi/iphonephp?mname=a

2012-03-16 15:26:36.259 customCellDemo[1553:f803] Data is :(null)

2012-03-16 15:26:43.624 customCellDemo[1553:f803] the Error massage is : Error 
Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" 
UserInfo=0x6ab2760 {NSURL=http://192.168.1.196/ravi/iphonephp?mname=a}
  • 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-31T09:54:14+00:00Added an answer on May 31, 2026 at 9:54 am

    From the manual of dataWithContentsOfURL;

    Return Value: A data object containing the data from the location
    specified by aURL. Returns nil if the data object could not be
    created.

    In other words, it can either not create an NSData (unlikely) or it can probably not get any data from your supplied URL. I suggest you try to use dataWithContentsOfURL:options:error: instead to get an error code and be able to diagnose the problem.

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

Sidebar

Related Questions

I want to send the following JSON text {Email:aaa@tbbb.com,Password:123456} to a web service and
I want to send the JSON text {} to a web service and read
I am getting data from severs in json format but i want that user
I want to send a JSON object from the client to an action on
Want to send the text from my current vb application to the Active Window
I have an issue with javascript/jQuery...I have a web service that will process information
I need to send a JSON request to a REST service. I'm using Restkit
i want to send a json string from a html webpage using javascript to
I'm having a strange problem with my WCF service that returns data in JSON
I want to send json formatted data to jQuery.css() function, and i dont know

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.