I am using the MediaWiki API in my iPhone app.
I am trying to load this link (JSON format of all images on the Wikipedia articles for "Spider" and "Cat"):
http://en.wikipedia.org/w/api.php?action=query&prop=images&format=json&imlimit=200&titles=Spider|Cat
My code for doing it is this:
NSString *urlPath = @"http://en.wikipedia.org/w/api.php?action=query&prop=images&format=json&imlimit=200&titles=Spider|Cat";
NSURL *URL = [NSURL URLWithString:urlPath]; // nil
I can go to the link just fine on my computer, but it refuses to load in this code. It does work, however, with other links, like this one (Just images for "Spider"):
http://en.wikipedia.org/w/api.php?action=query&prop=images&format=json&imlimit=200&titles=Spider
NSString *urlPath = @"http://en.wikipedia.org/w/api.php?action=query&prop=images&format=json&imlimit=200&titles=Spider";
NSURL *URL = [NSURL URLWithString:urlPath]; // works just fine
Is this a problem with the |
character in an NSString
? I don't understand why this would work for the second link, but not the first one.