思路:
UIButton *ceshiBtn = [[UIButton alloc]initWithFrame:CGRectMake(100, 100, 60, 60)];
ceshiBtn.backgroundColor = [UIColor blueColor];
[ceshiBtn setTitle:@"快捷方式" forState:UIControlStateNormal];
[ceshiBtn addTarget:self action:@selector(startServer) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:ceshiBtn];
/// 过度网页放在服务端 - (void)startServer { /* 这种方式所有处理都在服务端网页上 App基本不需要写多余的代码.直接跳转到指定的引导url地址就可以了. 缺点就是这种方式添加的桌面快捷方式,在没网的情况下,用户点击桌面上的快捷图标是不能跳转到app里面来的 */
NSString *urlStrWithPort = @"http://n8n233.natappfree.cc/index.html";
[self openUrl:[NSURL URLWithString:urlStrWithPort]]; } - (void)openUrl:(NSURL *)url { if (!url) { return; } if (@available(iOS 10.0, *)) { [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; } else { [[UIApplication sharedApplication] openURL:url]; } }
http://n8n233.natappfree.cc/index.html页面内容。测试使用后期可能连接不上
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="refresh" content="0;URL= data:text/html;charset=utf-8,%3C%21DOCTYPE%20html%3E%0D%0A%3Chtml%3E%0D%0A%3Chead%3E%0D%0A%20%20%20%20%3Cmeta%20name%3D%22apple-mobile-web-app-capable%22%20content%3D%22yes%22%3E%0D%0A%20%20%20%20%3Cmeta%20name%3D%22apple-mobile-web-app-status-bar-style%22%20content%3D%22black%22%3E%0D%0A%20%20%20%20%3Cmeta%20content%3D%22text%2Fhtml%20charset%3DUTF-8%22%20http-equiv%3D%22Content-Type%22%20%2F%3E%0D%0A%20%20%20%20%3Cmeta%20name%3D%22viewport%22%20content%3D%22width%3Ddevice-width%2Cinitial-scale%3D1.0%2Cuser-scalable%3Dno%22%20%2F%3E%0D%0A%20%20%20%20%3Clink%20rel%3D%27apple-touch-icon%27%20href%3D%27data%3Aimage%2Fjpeg%3Bbase64%2C%2F9j%2F4AAQSkZJ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A%2F%2F%22%20id%3D%22qbt%22%20style%3D%22display%3Anone%22%3E%3C%2Fa%3E%0D%0A%20%20%20%20%3Cspan%20id%3D%22msg%22%3E%3C%2Fspan%3E%0D%0A%3C%2Fbody%3E%0D%0A%3Cscript%3E%0D%0A%20%20%20%20if%20%28window.navigator.standalone%20%3D%3D%20true%29%0D%0A%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20var%20lnk%20%3D%20document.getElementById%28%22qbt%22%29.click%28%29%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20else%0D%0A%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20document.getElementById%28%22msg%22%29.innerHTML%3D%27%3Cdiv%20style%3D%22font-size%3A12px%22%3E%E8%BF%99%E9%87%8C%E5%8F%AF%E4%BB%A5%E6%B7%BB%E5%8A%A0%E5%BC%95%E5%AF%BC%E9%A1%B5%E9%9D%A2%3C%2Fdiv%3E%27%3B%0D%0A%20%20%20%20%7D%0D%0A%0D%0A%0D%0A%3C%2Fscript%3E%0D%0A%3C%2Fhtml%3E%0D%0A%0D%0A"> <title>我的应用</title> </head> <body> <a href="dreamoatestzdb://" id="qbt" style="display:none"></a> <span id="msg"></span> </body> </html>
标签:ceshiBtn,桌面,url,app,快捷方式,self From: https://www.cnblogs.com/OIMM/p/16802979.html