views:

26

answers:

3

I have a UIWebView that I'd like to load a web page and also append an object to the end of the address.

this is what I have:

NSString *urlAddress = @"http://www.wikipedia.org/%@",recipeName;

the name of a particular recipe would be appended to the end of the URL

I'm getting the "statically allocated instance of Objective-C class NSString" error. Is my syntax incorrect or is it something else?

I've been looking at this for quite a while now and thought I'd ask the community here.

thanks in advance.

A: 

Try this:

NSString *urlAddress = [NSString stringWithFormat: @"http://www.wikipedia.org/%@",recipeName];

Gubb
+1  A: 
NSString *urlAddress = [NSString stringWithFormat:@"http://www.wikipedia.org/%@",recipeName];

Try this code it will work..

hAPPY cODING...

Suriya
if I use:NSString *urlAddress = [NSString stringWithFormat:@"http://www.wikipedia.org/wiki/%@",recipe.name];the UIWebView loads a blank page.if I use:NSString *urlAddress = [NSString stringWithFormat:@"http://www.wikipedia.org/wiki/cheesburger"];it loads fine.I did a NSLog of recipe.name and it outputs to the console correctly.any idea where I'm going wrong? thanks for your post.
hanumanDev
maybe I should have said that recipe.name is coming from a core data/sqlite table. recipe being the entity and name the property
hanumanDev
Check out whether your recipe.name is giving you any content or not. Just add the line before the above code`NSLog(@"Recipe name :%@",recipe.name");`and after the above code`NSLog(@"URL :%@",urlAddress");`And check out whats the output for both and if still you are not able to get the proper output post on the values you obtained here.I think you are not getting any value in recipe.name.hAPPY cODING...
Suriya
A: 

You cannot create string with format directly, try [NSString stringWithFormat].

Well not fast enough I guess ...

Eric Fortin