iosopenurl升级|iOS APP如何实现版本检测更新



A. IOS判断app在appstore是否有可用的更新

iTunes可以提供app的版本信息,主要通过appid获取,使用时只需要到iTunes查找自己的appid,修改成自己的appid即可使用HTTP模式读取此链接可以获取app信息的json字符串贴出部分代码-(void)checkVersion{ ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:strURL]];//strURL为你的appid地址 [request setRequestMethod:@"POST"]; [request setDelegate:self]; [request startAsynchronous];}-(void)requestFinished:(ASIHTTPRequest *)request{ NSString *recStr = [[NSString alloc] initWithData:request.responseData encoding:NSUTF8StringEncoding]; recStr = [recStr :[NSCharacterSet ]];//返回的字符串有前面有很多换行符,需要去除一下 NSDictionary *resultDic = [JSONHelper DeserializerDictionary:recStr];//jsonhelper是我封装的json解析类,你可以使用自己方式解析 NSArray *infoArray = [resultDic objectForKey:@"results"]; if (infoArray.count > 0) { NSDictionary* releaseInfo =[infoArray objectAtIndex:0]; NSString* appStoreVersion = [releaseInfo objectForKey:@"version"]; NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary]; NSString *currentVersion = [infoDic objectForKey:@"CFBundleShortVersionString"]; NSArray *curVerArr = [currentVersion componentsSeparatedByString:@"."]; NSArray *appstoreVerArr = [appStoreVersion componentsSeparatedByString:@"."]; BOOL needUpdate = NO; //比较版本号大小 int maxv = (int)MAX(curVerArr.count, appstoreVerArr.count); int cver = 0; int aver = 0; for (int i = 0; i < maxv; i++) { if (appstoreVerArr.count > i) { aver = [NSString stringWithFormat:@"%@",appstoreVerArr[i]].intValue; } else{ aver = 0; } if (curVerArr.count > i) { cver = [NSString stringWithFormat:@"%@",curVerArr[i]].intValue; } else{ cver = 0; } if (aver > cver) { needUpdate = YES; break; } } //如果有可用的更新 if (needUpdate){ trackViewURL = [[NSString alloc] initWithString:[releaseInfo objectForKey:@"trackViewUrl"]];//trackViewURL临时变量存储app下载地址,可以让app跳转到appstore UIAlertView* alertview =[[UIAlertView alloc] initWithTitle:@"版本升级" message:[NSString stringWithFormat:@"发现有新版本,是否升级?"] delegate:self cancelButtonTitle:@"暂不升级" otherButtonTitles:@"马上升级", nil]; [alertview show]; } }}- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if (buttonIndex == 1){ UIApplication *application = [UIApplication sharedApplication]; [application openURL:[NSURL URLWithString:trackViewURL]]; }}

B. IOS下使用openUrl下打开不同的系统应用和设置界面

[[UIApplication sharedApplication] openURL:url];通过给url不同的值,可以实现调用系统自带 电话/短信/邮箱/浏览器/… 1、调用 电话phone [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://800888"]]; 拨打电话时不出现确认框 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://800888"]]; 拨打电话之时弹出确认框 2、调用自带 浏览器safari [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.abt.com"]]; 3、调用 自带Mail [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://[email protected]"]]; 4、调用 SMS [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://800888"]]; 5、调用 app Store [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://"]]; 6、调用 iBook [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-books://"]]; 7、调用 Map [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"maps://"]]; 8、调用 Facetime [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"facetime://"]]; 注意后面加上faceTime的账号如:[email protected]qq.com 9、调用 Music [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"music://"]]; 10、跳转到系统设置相关界面 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=wifi"]]; 以下为设置的跳转关键字 //打开关于本机 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=About"]]; //打开辅助功能 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=ACCESSIBILITY"]]; //设置飞行模式不成功,即设置界面 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=AIRPLANE_MODE"]]; //屏幕几分钟之后锁定设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=AUTOLOCK"]]; //打开Brightness不成功,设置界面 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Brightness"]]; //打开蓝牙设置 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Bluetooth"]]; //设置日期与时间设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=DATE_AND_TIME"]]; //打开FaceTime设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=FACETIME"]]; //下面是打开通用设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General"]]; //打开键盘设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Keyboard"]]; //打开iClound设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=CASTLE"]]; //打开iCloud下的储存空间 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=CASTLE&path=STORAGE_AND_BACKUP"]]; //打开通用下的语言和地区设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=INTERNATIONAL"]]; //打开隐私下的定位服务 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]]; //打开设置下的音乐 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=MUSIC"]]; //打开音乐下的均衡器 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=MUSIC&path=EQ"]]; //打开音乐下的什么不成功 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=MUSIC&path=VolumeLimit"]]; //打开通用下的网络不成功 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Network"]]; //打开通用下的什么不成功 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=NIKE_PLUS_IPOD"]]; //打开设置下的备忘录设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=NOTES"]]; //打开设置下的通知设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=NOTIFICATIONS_ID"]]; //打开电话设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Phone"]]; //打开设置下照片和相机设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Photos"]]; //打开通用下的描述文件 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=ManagedConfigurationList"]]; //打开通用下的还原设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Reset"]]; //打开设置下的safari设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Safari"]]; //打开siri不成功 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Assistant"]]; //打开设置下的声音设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Sounds"]]; //打开通用下的软件更新 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=SOFTWARE_UPDATE_LINK"]]; //打开通用下的iTounes Store和App Store设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=STORE"]]; //打开设置下的twitter设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=TWITTER"]]; //打开通用下的用量 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=USAGE"]]; //打开通用下的vpn设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=VPN"]]; //打开设置下的墙纸设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Wallpaper"]]; //打开wifi设置 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]]; //打开不成功 //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root= INTERNET_TETHERING"]];摘自: http://blog.sina.com.cn/s/blog_a1434bd50102w5b9.html

C. IOS6中open,openurl命令不能用了吗

IOS6以上版本的SSH终端中屏蔽了OPEN和OPENURL这两个命令用不了了,很遗憾!

D. ios 能处理openurl之后的吗

可以的 可以的

E. ios openurl为什么打不开 2016

这个苹果wwdc上的信息是过时的,苹果意识到自己的错误又做了修改,现在是不加白名单的话openurl可以正常使用和以前一样,canopenurl对白名单里面的urlscheme返回yes(以上前提是机器安装了对应app)实践是检验真理的唯一标准,少年这个你自己试一下就知道了啊。我估计以后应该不会改了

F. IOS openURL打开系统内置应用

openURL方法,可以打开一些内置的IOS应用,包括打开浏览器,打开google地图,拨打电话,发送短信和发送E-mail等。打开浏览器: NSURL * url = [NSURL URLWithString:@“https:www..com”]; [UIApplication sharedApplication] openURL:url]; 拨打电话: [UIApplication sharedApplication] openURL:[NSURL URLWithString:@“tel:/10086”]]; 发送短信: [UIApplication sharedApplication] openURL:[NSURL URLWithString:@“sms:/10086”]]; 发送E-mail(简单的不带附件的): [UIApplication sharedApplication] openURL:[NSURL URLWithString:@“mailto://[email protected]”]];

G. iOS APP如何实现版本检测更新

如果我们要检测app版本的更新,那么我们必须获取当前运行app版本的版本信息和appstore 上发布的最新版本的信息。当前运行版本信息可以通过info.plist文件中的bundle version中获取;要获取当前app store上的最新的版本,有两种方法,一、在某特定的服务器上,发布和存储app最新的版本信息,需要的时候向该服务器请求查询。二、从app store上查询,可以获取到app的作者,连接,版本等。官方相关文档www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.htm具体步骤如下:1,用 POST 方式发送请求:http://itunes.apple.com/search?term=你的应用程序名称&entity=software更加精准的做法是根据 app 的 id 来查找:http://itunes.apple.com/lookup?id=你的应用程序的ID#define APP_URL http://itunes.apple.com/lookup?id=你的应用程序的ID你的应用程序的ID 是 itunes connect里的 Apple ID2,从获得的 response 数据中解析需要的数据。因为从 appstore 查询得到的信息是 JSON 格式的,所以需要经过解析。解析之后得到的原始数据就是如下这个样子的:{ resultCount = 1; results = ( { artistId = 开发者 ID; artistName = 开发者名称; price = 0; isGameCenterEnabled = 0; kind = software; languageCodesISO2A = ( EN ); trackCensoredName = 审查名称; trackContentRating = 评级; trackId = 应用程序 ID; trackName = 应用程序名称"; trackViewUrl = 应用程序介绍网址; userRatingCount = 用户评级; = 1; version = 版本号; wrapperType = software; } ); } 然后从中取得 results 数组即可,具体代码如下所示:NSDictionary *jsonData = [dataPayload JSONValue]; NSArray *infoArray = [jsonData objectForKey:@"results"]; NSDictionary *releaseInfo = [infoArray objectAtIndex:0]; NSString *latestVersion = [releaseInfo objectForKey:@"version"]; NSString *trackViewUrl = [releaseInfo objectForKey:@"trackViewUrl"]; 如果你拷贝 trackViewUrl 的实际地址,然后在浏览器中打开,就会打开你的应用程序在 appstore 中的介绍页面。当然我们也可以在代码中调用 safari 来打开它。UIApplication *application = [UIApplication sharedApplication]; [application openURL:[NSURL URLWithString:trackViewUrl]]; 代码如下:-(void)onCheckVersion{ NSDictionary *infoDic = [[NSBundlemainBundle] infoDictionary]; //CFShow((__bridge CFTypeRef)(infoDic)); NSString *currentVersion = [infoDic objectForKey:@"CFBundleVersion"]; NSString *URL [email protected]"http://itunes.apple.com/lookup?id=你的应用程序的ID"; NSMutableURLRequest *request = [[NSMutableURLRequestalloc] init]; [requestsetURL:[NSURLURLWithString:URL]]; [requestsetHTTPMethod:@"POST"]; NSHTTPURLResponse *urlResponse = nil; NSError *error = nil; NSData *recervedData = [:request returningResponse:&urlResponse error:&error]; NSString *results = [[NSStringalloc] initWithBytes:[recervedDatabytes] length:[recervedDatalength] encoding:NSUTF8StringEncoding]; NSDictionary *dic = [results JSONValue]; NSArray *infoArray = [dic objectForKey:@"results"]; if ([infoArray count]) { NSDictionary *releaseInfo = [infoArray objectAtIndex:0]; NSString *lastVersion = [releaseInfo objectForKey:@"version"]; if (![lastVersion isEqualToString:currentVersion]) { //trackViewURL = [releaseInfo objectForKey:@"trackVireUrl"]; UIAlertView *alert = [[UIAlertViewalloc] initWithTitle:@"更新"message:@"有新的版本更新,是否前往更新?" delegate:self cancelButtonTitle:@"关闭"otherButtonTitles:@"更新",nil]; alert.tag =10000; [alertshow]; } else { UIAlertView *alert = [[UIAlertViewalloc] initWithTitle:@"更新"message:@"此版本为最新版本" delegate:selfcancelButtonTitle:@"确定" otherButtonTitles:nil,nil]; alert.tag =10001; [alertshow]; } }}- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if (alertView.tag==10000) { if (buttonIndex==1) { NSURL *url = [NSURLURLWithString:@"https://itunes.apple.com"]; [[]openURL:url]; } }}

H. IOS10.2 OpenURL 打电话会先弹系统框,有其他方法吗

1、下载最新的itunes,备份资料 2、在苹果官网下载最新的匹配型号的ios9.3.2系统版本 3、手机连接itunes,按住shift建点击系统更新,选择下载好的ios9.3.2,然后开始更新了 4、整个过程会自动完成。等待开机界面吧!

I. ios 开发10.0以上openurl跳转系统设置界面失败怎么解决

好几种方法吧,可以用广播(通知),可以给B页面的公共参数赋值 赋值为1表示A按钮,2表示B按钮。tag的话估计是给B.tag赋值吧


赞 (0)