【发布时间】:2014-12-09 02:02:19
【问题描述】:
我正在尝试让 mailto 链接与 UIWebView 一起使用。
到目前为止,我正在使用下面的委托打开一系列内容(http://、file:// 等),它们都可以正常工作。但是,似乎 mailto 甚至没有到达那里,如果我对传入的每个 url 都发出警报,所有其他的都会发出警报,但 mailto 链接没有任何内容。
Xcode 确实抛出了
WebKit discarded an uncaught exception in the webView:decidePolicyForNewWindowAction:request:newFrameName:decisionListener: delegate: <NSRangeException> *** -[__NSArrayI objectAtIndex:]: index 4294967295 beyond bounds [0 .. 0]
委托
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = request.URL;
NSArray *components = [url.absoluteString componentsSeparatedByString:@"/"];
NSString *folder = [components objectAtIndex:[components count]-2];
UIAlertView *display_url = [[UIAlertView alloc]initWithTitle:@"Warning" message:[NSString stringWithFormat:@"URL %@ ", request.URL.scheme] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[display_url show];
[...]
关于为什么“mailto”链接会被忽略并抛出错误的任何想法?
【问题讨论】:
标签: ios objective-c uiwebview mailto