gpt4 book ai didi

iphone - 如何使用 UIWebview 加载本地 .html 文件?

转载 作者:行者123 更新时间:2023-12-03 19:42:56 24 4
gpt4 key购买 nike

我正在尝试使用下面所示的方法加载本地存储在应用程序文档目录中的 HTML 文件。它不起作用。我做错了什么?

    NSLog(@"Loading Saved Copy!");
urlAddress = [[self documentsDirectory] stringByAppendingPathComponent:@"/Profile/profile.html"];


//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webView loadRequest:requestObj];

最佳答案

改用+[NSURL fileURLWithPath:isDirectory:]

关于iphone - 如何使用 UIWebview 加载本地 .html 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2170929/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com