1

I have a UIWebview that loads a local asp website, it works properly on the Simulator but not on the device. I don't know where is the problem ?

Here is my code :

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSString *index = @"http://192.168.205.146:31021/";
    NSURL *url = [NSURL URLWithString:index];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

    [webView loadRequest:requestObj];
}

And

- (BOOL)webView:(UIWebView*)webViewRef shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
    return YES;
}

Thanks for your help.

user2037696
  • 1,055
  • 3
  • 16
  • 33
  • Simulator is using your Mac's LAN Connection I guess (which has localhost server) and your iPhone might be using your mobile data (i.e 2G or 3G). Check if that is the case. Let me know if this works. – Parth Bhatt Jul 10 '13 at 09:08
  • Is your device on the same network as your mac? – lmnbeyond Jul 10 '13 at 09:09
  • May be you can try "Internet Sharing" from your Mac from Preferences for your Ethernet connection. And connect to that Wifi in iPhone and see if it loads. I think this should work. – Parth Bhatt Jul 10 '13 at 09:10

1 Answers1

0

Simulator is using your Mac's LAN connection, I guess (which has local-host server) and your iPhone might be using your mobile data (i.e 2G or 3G).

Check if that is the case.

May be you can try "Internet Sharing" from your Mac from Preferences for your Ethernet connection.

And connect to that Wifi in iPhone and see if it loads.

I think this should work and solve your problem of testing on device if you don't have router with your connection.

Let me know if you need more help.

Parth Bhatt
  • 19,381
  • 28
  • 133
  • 216