gpt4 book ai didi

ios webcal 请求 - 完成回调?

转载 作者:行者123 更新时间:2023-11-28 22:39:31 27 4
gpt4 key购买 nike

NSURL *url = [NSURL URLWithString:@"valid_webcal_url"];
if (![[UIApplication sharedApplication] openURL:url])
{
// failure callback
NSLog(@"%@%@",@"Failed to open url:",[url description]);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:LCHLocalizedString(@"SUBSCRIBE_ERROR", nil) message:nil delegate:self cancelButtonTitle:@"Okay" otherButtonTitles: nil];
[alert show];
}

所以我想出了如何查看加载 webcal 是否有错误,但是我怎么知道 webcal 何时加载成功?当点击“订阅”按钮时,我会显示一个加载器,只需要知道何时关闭它。

最佳答案

如评论中所述,这会将您的应用程序置于后台,无法保证自动返回。

假设您确实想要调用一个网页(而不是进行网络 API 调用),您可能应该创建一个带有嵌入式 UIWebViewUIViewController 的自定义子类。

将您的子类设置为 UIWebView 的委托(delegate)将允许您对失败/成功使用react。您甚至可以拦截和停止 UIWebView 调用 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType

关于ios webcal 请求 - 完成回调?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14964429/

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