This is the a button which when clicked will open up Safari.
-(IBAction)loginClicked:(id)sender{
NSLog(@"loginClicked");
NSLog(@"currentSelectedRow = %i", currentSelectedRow );
loginObj = [appDelegate.loginArray objectAtIndex:currentSelectedRow];
NSLog(@"URL = %@", loginObj.loginURL);
Error-->[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"%@", loginObj.loginURL]];
}
Error: Too many arguments to method call, expected 1, have 27
If I replace [[UIApplication sharedApplication] with
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"www.google.com"]];
Safari can be launched and will go to Google and my debugger shows the following
2012-01-26 16:04:15.546 Login2[197:707] loginClicked
2012-01-26 16:04:15.550 Login2[197:707] currentSelectedRow = 0
2012-01-26 16:04:15.555 Login2[197:707] URL = www.amazon.com
It seems that I have pulled the URL from my array correctly but I can’t implement it to the code to open the URL in Safari.
1 Answer