メインストーリーボードにボタンが1つあります。正しくリンクされていることは確かですが、シミュレーターを実行してボタンを押すと、何も起こりません。Safariを開くためのボタンを取得するために何が欠けていますか?
Viewcontroller.h
#import <UIKit/UIKit.h>
@interface testViewController : UIViewController
- (IBAction)openSafari:(id)sender;
@end
Viewcontroller.m
#import "testViewController.h"
@interface testViewController ()
@end
@implementation testViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (IBAction)openSafari:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"www.google.com"]];
}
@end