0

I am building an app that would run a website through my app. Basically the webView. I had no problems so far since the last xCode update. It basically runs with no errors but it does not work on iOs 6 simulator or device.

.h fle:

@interface ViewController : UIViewController{
    IBOutlet UIWebView *nView;
}

.m file:

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSURL * myURL = [NSURL URLWithString:@"http://www.google.com"];

                     NSURLRequest *myRequest = [NSURLRequest requestWithURL:myURL];

                     [nView loadRequest:myRequest];


}

If anyone can help I would be grateful. Thank you

Al K
  • 141
  • 2
  • 11
  • "it does not work" - Please be more specific. – sosborn Oct 16 '12 at 00:29
  • I should have said it crashes when I run it but I somehow got it fixed now. although now I have another issue. Can you help? If yes, see the answer I posted below – Al K Oct 16 '12 at 00:41

1 Answers1

0

I managed to get it working!

.h file:

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@property (weak, nonatomic) IBOutlet UIWebView *myWebView;

@end

.m file:

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSURL *url =[NSURL URLWithString:@"http://www.google.com"];
    NSURL*request = [NSURLRequest requestWithURL:url];
    [[self myWebView]loadRequest:request];
}

I included a property on h file and with some research I got the .m file working too. Although I got an issue saying:

Incompatible pointer types sending 'NSURL *__strong' to parameter of type 'NSURLRequest *'

Can anybody help to get rid of this issue as well please?

Al K
  • 141
  • 2
  • 11
  • 2
    You should have made this a separate question. Regardless, you declare NSURL*request when it should be NSURLRequest *request. – sosborn Oct 16 '12 at 00:48