大佬教程收集整理的这篇文章主要介绍了iphone – 以编程方式点击HTML href以更新应用程序,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
href="itms-services://?action=download-manifest&url=http://example.com/ manifest.plist"
见http://help.apple.com/iosdeployment-apps/#app43ad871e
我不想这样做.我希望应用程序以编程方式检查启动时的更新,并使用UIAlertView提醒用户可以获得更新.
这是我到目前为止在应用中所做的事.FinishLaunching.复杂的plist解析来自这里找到的示例plist的结构:http://help.apple.com/iosdeployment-apps/#app43ad78b3
NSLog(@"checking for @R_944_9531@e"); NSData *plistData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://example.com/MyApp.plist"]]; if (plistData) { NSLog(@"finished checking for @R_944_9531@e"); NSError *error; NSPropertyListFormat format; NSDictionary *plist = [NSPropertyListserialization propertyListWithData:plistData options:NSPropertyListImmutable format:&format error:&error]; if (plist) { NSArray *items = [plist valueForKey:@"items"]; NSDictionary *Dictionary; if ([items count] > 0) { Dictionary = [items objectATindex:0]; } NSDictionary *MetaData = [Dictionary objectForKey:@"Metadata"]; float currentVersion = [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundLeversion"] floatValue]; float newVersion = [[MetaData objectForKey:@"bundle-version"] floatValue]; NSLog(@"newVersion: %f,currentVersion: %f",newVersion,currentVersion); if (newVersion > currentVersion) { NSLog(@"A new @R_944_9531@e is available"); UIAlertView *alert = [[UIAlertView alloc] initWithtitle:@"@R_944_9531@e available" message:@"A new @R_944_9531@e is available." delegate:self cancelButtontitle:@"Cancel" otherButtontitles:@"@R_944_9531@E",nil]; [alert show]; } } }
- (void)alertView:(UIAlertView *)alertView clickedButtonATindex:(NSInteger)buttonIndex { if (buttonIndex == 1) { NSLog(@"downloading full @R_944_9531@e"); UIWebView *webView = [[UIWebView alloc] init]; [webView loadrequest:[[NSURLrequest alloc] initWithURL:[NSURL URLWithString:@"itms-services://?action=download-manifest&url=http://example.com/MyApp.plist"] cachePolicy:NSURLrequestuseProtocolCachePolicy timeoutInterval:10.0]]; } }
一些东西:
>我知道[alert show]不应该在应用程序didFinish中调用,但我稍后会更改它.
>我不知道下载plistData的速度有多快以及下载如何影响应用程序.
>更重要的是,我的警报视图委托方法不起作用,并且不下载更新.即使我使用@property(非原子,强)UIWebView * webView引入webView,该方法也不会做任何事情.
>我认为DropBox已正确配置MIME,因为我可以通过谷歌Chrome下载.ipa.
所以我真正需要的是使用NSURLConnection(NSURLrequest等)来复制用户点击HTML href的行为.之后,我认为将进行全面更新.
以上是大佬教程为你收集整理的iphone – 以编程方式点击HTML href以更新应用程序全部内容,希望文章能够帮你解决iphone – 以编程方式点击HTML href以更新应用程序所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。