0

I have a strange behave: After making a few changes in my code, I got an unasked URL in the NSURL. Actually, this URL was valid in a test I made yesterday, but the system remembers this URL and I cannot changed it even in another app.

When I strted a new app with the followung code:

int main(int argc, char *argv[]) {
    NSURL *URLurl = [NSURL URLWithString:@"http://www.google.com"];
    NSLog([URLurl absoluteString]);
}

the baseUrl is something like: http:inl.co.il, even I asked for google.com, the NSLog is correct and prints: http://www.google.com

But it does not help me since the base is what the entire code works with.

And strangly, where from is that NSURL taking this old unused string?

Any help?

Thank you

1
  • where is the code where you get the 'wrong' url? Feb 26, 2010 at 10:29

1 Answer 1

1

Never log variables directly inside of NSLog like this, as any percent symbols will easily cause mayhem. Instead do:

NSLog(@"%@", [URLurl absoluteString]);

Lacking further information, this is probably the root of the problem. Also, the compiler should be warning you your original statement is dodgy, anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.