I'm trying to open url in safari with this code:
- (IBAction)webButton:(id)sender {
NSString *url = @"www.google.com";
url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:url]];
}
But every time app crashes up.
Has someone been in similar situation?
Here is ss off crash: http://dl.dropbox.com/u/77033905/urlInSafariCrashesUp.png
UPDATE:
NSString *recipients = @"mailto:first@example.com?subject=Hello from Croatia!";
NSString *body = @"&body=It is sunny in Croatia!";
NSString *email = [NSString stringWithFormat:@"%@%@", recipients, body];
email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
This is for opening mail but same over sharedApplication. It crashes up to.
UPDATE 2: Console log: argv char ** 0xbffff520 *argv char * 0xbffff658 **argv char '/' argc int 1
UPDATE 3: It calls IBAction but crashes up. When I try this code in root view it works. I addedd and connected in IB button and everything is ok with that.
Is there problem with calling UIApplication sharedApplication in subview? Should I call on different way?
UPDATE 4:
I figure it out that problem is even when i call empty IBAction in subview, so problem obviously is not in UIApplication but in calling IBAction in subview.
- (IBAction)webButton:(id)sender {
// empty
}
UPDATE 5: Solution: How to call IBAction in subview?