1 xCode调出Archives界面:window -> organizer
2 webview
[code lang="swift"]
class ViewController: UIViewController {
@IBOutlet weak var webview: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// 1.设置访问资源 - 百度搜索
let url = URL(string: "http://feizhaojun.com");
// 2.建立网络请求
let request = URLRequest(url: url!);
// 3.加载网络请求
webview.loadRequest(request)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
[/code]
发送http请求
因为xCode7开始,默认发送https请求,所以需要修改Info.plist:Open As source code,添加:
[code lang="html"]
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
[/code]
您的赞助将会支持作者创作及本站运维
发表评论