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

  • Home
  • SEARCH
  • 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 883943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:40:30+00:00 2026-05-15T12:40:30+00:00

I am developing Twitter API to my application. In my app, I want to

  • 0

I am developing Twitter API to my application. In my app, I want to display the tiny url with parsed xml link in UITexField as dynamically. statically, I could able to display tiny url in UITextField, but dynamically I am not able to display the tiny url. Please help me!

Code: statically(Working fine),

NSURL *url = [NSURL URLWithString"http://tinyurl.com/api-create.php?
url=https://gifts.development.xxxxx.edu/xxxx/Welcome.aspx?appealcode=23430"];

NSString *link = [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding    error:nil]; 

Dynamically,

NSString * tiny = [NSString stringWithFormat:@"http://tinyurl.com/api-create.php? url=%@", shtUrl];//shtUrl is parsed string 

NSURL *url = [NSURL URLWithString:tiny];

NSString *link = [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding    error:nil]; 

In above, dynamically app running without warning and error, but url not displayed and when I am checking debugger, url and link both are show nil value. But shtUrl show whole url value as properly.

I tried with all NSURL class and instance methods and String methods also.

  • 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-15T12:40:31+00:00Added an answer on May 15, 2026 at 12:40 pm

    In this line of your code:

    NSString * tiny = [NSString stringWithFormat:@"http://tinyurl.com/api-create.php? url=%@", shtUrl];
    

    there is a space after the ‘api-create.php?’. This will result in a space in the formated string you are creating and will probably result in URLWithString: being unable to parse the url and returning nil.

    Remove the extra space (assuming that it is really there and not just a cut-n-paste error) and see if that fixes the problem.

    It’s also possible that the shtUrl that you are building a tinyurl for contains special characters that would need to be urlencoded (i.e. percent escaped.) Try adding this:

    NSString * encodedShtUrl = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,
                                                                                   (CFStringRef)shtUrl,
                                                                                   NULL,
                                                                                   (CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ",
                                                                                   kCFStringEncodingUTF8 );
    

    to encode the shtUrl, then use the encodedShtUrl when creating tiny:

    NSString * tiny = [NSString stringWithFormat:@"http://tinyurl.com/api-create.php? url=%@", encodedShtUrl];
    

    See http://simonwoodside.com/weblog/2009/4/22/how_to_really_url_encode/ for more about the escaping.

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

Sidebar

Related Questions

I'm on developing a twitter kind of Application where in I want that the
I am developing a php web site. Here I want to display twitter updates
I'm developing Twitter application with xAuth support using twitter4j jar file. I want to
Any good source/website/inputs/sample to kickstart developing a twitter application using twitter API? Edit :
I am developing an application using twitter api and that involves writing a method
I developing an android application in which i want to integrate faceebook and twitter.
I'm developing a Twitter application on OAuth and I want to provide the ability
Developing a web application that I've registered with Twitter. In this app, I might
I'm developing a application that uses the twitter API. I'm currently using rspec with
I'm developing a twitter messaging utility using Twitter API (twitterizer). But since I'm within

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.