【问题标题】:WebView load in simulator but not in deviceWebView 在模拟器中加载但不在设备中
【发布时间】:2016-05-24 17:43:37
【问题描述】:

我的应用程序在模拟器中加载网站,但是当我在设备上运行时它没有出现

是 xcode 的问题吗?或者可能是更新问题(我的 iPhone 显示已准备好更新但我没有)

这是我的代码

#import "twitterViewController.h"

@interface twitterViewController ()

@end

@implementation twitterViewController


- (void)viewDidLoad {
    [super viewDidLoad];

    // Do any additional setup after loading the view.

    NSString *webSite=@"https://www.youtube.com/"; //It's like a template page
    NSURL *url = [NSURL URLWithString:webSite];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];

    [twitterWeb loadRequest:request];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

【问题讨论】:

  • 您可以转到您尝试在设备上的 Safari 中加载的网页吗?它在那里加载吗?当您在设备上运行时,您是否在设备控制台中收到任何错误消息?
  • 你的真实网址是什么?

标签: ios objective-c iphone uiwebview


【解决方案1】:

在模拟器中加载网站,但是我在设备上运行时却没有出现,

文件名可能有问题。意思是,假设你的文件想要加载文件'Abc.js',而它的名字是'abc.js。

你应该检查你的“网址”

【讨论】:

    最近更新 更多