【发布时间】:2016-11-23 19:14:14
【问题描述】:
根据 Apple 的 docs,错误 9802 是“致命警报”。我查看了 Google 和 SO 并没有发现任何引用 9802 来解决此问题。我可以将我的代码更改为“apple.com”并获得该页面,但是使用我自己的 URL,我得到了上面的错误。我已经尝试了我能想到的一切,但没有任何效果。是时候寻求帮助了! :D
使用结果
/usr/bin/nscurl --ats-diagnostics https://pragerphoneapps.com
是否所有测试都失败了(结果上传here)
这是我应用的 .plist 文件的图像(仅相关部分)
这是目标信息的图像:
这是我的代码:
- (IBAction)showHTMLHelp:(UIButton *)sender {
// make the popover
UIViewController* popoverContent = [UIViewController new];
UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 450, 500)];
popoverView.backgroundColor = [UIColor colorWithWhite:(CGFloat)1.0 alpha:(CGFloat)1.0]; // frame color?
popoverContent.view = popoverView;
//resize the popover view shown in the current view to the view's size
popoverContent.preferredContentSize = CGSizeMake(450, 500);
NSString *urlAddress = @"https://pragerphoneapps.com"; // @"https://www.pragerphoneapps.com/bookstore-inventory-manager/upload-help/";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
// add the UIWebView for RichText
UIWebView *webView = [[UIWebView alloc] initWithFrame: popoverView.frame];
webView.backgroundColor = [UIColor whiteColor]; // change background color here
// add the webView to the popover
[webView loadRequest:requestObj];
[popoverView addSubview:webView];
// if previous popoverController is still visible... dismiss it
if ([popoverController isPopoverVisible]) {
[popoverController dismissPopoverAnimated:YES];
}
//create a popover controller
popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent];
[popoverController presentPopoverFromRect:((UIButton *)oShowHelp).frame inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
【问题讨论】:
-
它是否适用于 http 域?如果是这样,那么问题不太可能是您的代码。检查这个; stackoverflow.com/questions/38719075/…
-
no... 不适用于 http 或 https;给出此错误:App Transport Security 已阻止明文 HTTP (http://) 资源加载,因为它不安全。可以通过应用的 Info.plist 文件配置临时例外。
-
您的目标站点已被入侵或证书不正确。它甚至不会在 chrome 中打开。
-
for https:,你说得对,它不是一个安全的网站,但我可以用 http: 打开它:并且只是 pragerphoneapps.com
-
看来我需要该域的 SSL 证书(Apple 自 2017 年 1 月 1 日起的新要求);现在订购,应该会在 24 小时内安装并工作...安装后我会尽快回复您...谢谢约翰...稍后与您聊天
标签: objective-c uiwebview nsurlconnection ios10 nsurlrequest