Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to open url on button click in iPhone

I have a url which i have in NSString urlone which is coming from xml. but i run application it gives excess bad error

  // urlone contains  http://www.forasinvest.com/v2/index.php    NSString*myurl=urlone;   NSURL *url = [NSURL URLWithString:myurl];   [[UIApplication sharedApplication] openURL:url]; 
like image 997
jogi alamni Avatar asked Jan 05 '12 06:01

jogi alamni


2 Answers

i think it should work fine, ok just copy paste the following for testing simply

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://www.forasinvest.com/v2/index.php"]]; 
like image 92
Najeebullah Shah Avatar answered Oct 16 '22 23:10

Najeebullah Shah


NSString *pURL = @"xyz.cpm";  if( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:pURL]])     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:pURL]]; 
like image 30
Shubham JAin Avatar answered Oct 17 '22 00:10

Shubham JAin