Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

"Bad URL" error, any ideas?

nsbucknernsbuckner Posts: 6New Users
edited July 2010 in iPhone SDK Development
Hi,
I have an application that is pulling data from specific url's. This works fine if I type in the URL manually and run it that way. The problem I run in to is when I try to create the URL based on the user's choice for what category they are trying to view. Any help would be greatly appreciated.

Error:
Error Domain=NSURLErrorDomain Code=-1000 "bad URL" UserInfo=0x5948b80 {NSUnderlyingError=0x5948ac0 "bad URL", NSLocalizedDescription=bad URL}

Code:
NSString *url =[[[NSString alloc] initWithString:kScoresURLPath] retain];
 NSString *toGO = [appDelegate.classForScores stringByReplacingOccurrencesOfString:@" " withString:@"|"];
url = [url stringByAppendingString:@"?Class="];
url = [url stringByAppendingString:toGO];
url = [url stringByAppendingString:@":8080"];
connectionBuffer = [[NSMutableData alloc] init];
NSLog(url);
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
self.scoreFetchConnection = [[[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES] autorelease];
[request release];

The code gives me the correct URL when I print it with NSLog, however when I actually try to use it I get the above error.
Post edited by nsbuckner on

Replies

Sign In or Register to comment.