iphone - isn't launching my URL? -
i've got question regarding sharedapplication.
i'm reading particular link xml file onto app itself, , had stored inside nsstring. tried convert nsstring nsurl sharedapplication open it, doesn't seems work. way me work define string myself without passing in information xml.
currently, code stands this:
nsstring *urlstring = [item objectforkey@"officialweb"]; // reading xml nsurl *url = [nsurl urlwithstring:urlstring]; nslog(@"url: %@", url); // displays (null) printf("url: %s, \n", [urlstring utf8string]); // displays proper url [uiapplication sharedapplication] openurl:url];
if use codes above, safari not launch , nsurl returns (null) results.
i've searched site , googled solutions, best saw include:
urlstring = [urlsting stringbyaddingpercentescapeusingencoding: nsutf8stringencoding]];
into code. app launches safari after adding that, url turns out in extremely weird manner. "http://url.com/%0%0%a" or whatnot instead of "http://url.com" stated in xml file.
i appreciate if point me in proper direction regarding this.
what happens if nsurl *url = [nsurl urlwithstring:[urlstring utf8string]]; ?
Comments
Post a Comment