views:

47

answers:

2

i am trying to open a url (http://c22.smaato.net/oapi/lp.jsp;jsessionid=E253E547A55290CA553F493659433DBF.c22) on a button through the following code

NSString *strs=[[NSString alloc]initWithFormat:@"%@",[linkArry objectAtIndex:0]];



    NSURL *urls = [NSURL URLWithString:strs];



    [[UIApplication sharedApplication] openURL:urls];

[linkArry objectAtIndex:0] is the link mentioned above.

but it is not responding?? if i type something like "http://www.google.com" it works..

is there any other method to open these urls??

A: 

Make sure that url is of NSURL type and not NSString

dusker
it is of NSURL type
hemant
A: 

Check the line

NSURL *urls = [NSURL URLWithString:strs];

NSlog("urls : %@", urls); and print the urls in console , if you find urls is nil,

then escape the strs with NSUTF8StringEncoding.

strs = [strs stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSURL *urls = [NSURL URLWithString:strs];

Biranchi