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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:56:26+00:00 2026-05-28T13:56:26+00:00

Hi I have to send data to server via JSON and usually I do

  • 0

Hi I have to send data to server via JSON and usually I do it like that:

  NSMutableString * temp=[[NSMutableString alloc] initWithString:service_registra_inc];
   //here I add more staff to temp
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:temp]];
    [[NSURLConnection alloc] initWithRequest:request delegate:self];

but I get some error message that the url is wrong: something like url length but I have searched around and it means I have to escape my url si I have found this fonction that doesn’t work for me:

 NSString *temp2=(__bridge_transfer NSString*)CFURLCreateStringByAddingPercentEscapes(NULL,((CFStringRef)temp.UTF8String),NULL,NULL,kCFStringEncodingUTF8);

and there the program just stops and it says signal EXC_BAD_ACCess.

Well I don’t really know how to transform mutable strings into CFStringRef so xcode just suggested the corrections for me but I don’t really understand what is happening. Please help…. I have read the doc but it doesn’t say how to cast NSSMutableString to CFStringRef and back or how to use the whole thing to create an NSURL object directly. Thks

  • 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-28T13:56:27+00:00Added an answer on May 28, 2026 at 1:56 pm

    Why are you using CFURL & CFStringRef functions here?

    You could do what you are trying to do via NSString’s stringByAddingPercentEscapesUsingEncoding: method. I’ve linked the documentation for you.

    Something like:

     NSMutableString * temp=[[NSMutableString alloc] initWithString:service_registra_inc];
    
     // append your staff... errr, stuff here.
    
     NSString * temp2 = [temp stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
     NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:temp2]];
     [NSURLConnection alloc] initWithRequest:request delegate:self];
    

    (don’t forget to release things if you’re not using ARC)

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

Sidebar

Related Questions

first I got JSON data via web server just like $.getJSON(url,function(){ //my callback function;
Hi I want to send data to the server and then have the php
I want to send the form data to server-side. I have two ways: Normal
I have a Flash program that needs to make url requests to send data
I created the list that have device detected, and I want to send data
I am trying to send data to my server using HttpPost via the following
I have an Android app that communicates with a server via asynchronous socket connection
I am attempting to send Base64 image data via ajax to Server. Sometimes all
I know how to send byte data to a server via the udp protocol.
I have a simple TCP server that communicates with some devices via GPRS. It

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.