2012-02-03 2 views
5

임시 배포 된 엔터프라이즈 앱에 대한 업데이트를 계획하고 있습니다. 업데이트앱을 업데이트하기 위해 프로그래밍 방식으로 HTML href를 누릅니다.

는, 애플은 사용자가 링크를 HTML 페이지를 방문하여 탭을 갖는 것이 좋습니다 :

href="itms-services://?action=download-manifest&url=http://example.com/
manifest.plist" 

내가이 일을하지 않으려는 http://help.apple.com/iosdeployment-apps/#app43ad871e

를 참조하십시오. 앱이 출시 될 때 업데이트를 프로그래밍 방식으로 확인하고 UIAlertView를 통해 업데이트를 사용할 수 있도록 사용자에게 경고하기를 원합니다.

여기 내가 지금까지 응용 프로그램에서 가지고있는 것이 FindingLaunching입니다. 복잡한 PLIST 구문 분석 예제 PLIST의 구조에서 비롯는 여기에서 찾을 :

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
{ 
    if (buttonIndex == 1) { 
     NSLog(@"downloading full update"); 
     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]]; 
    } 
} 

몇 가지 : 내가 아는

  • http://help.apple.com/iosdeployment-apps/#app43ad78b3

    NSLog(@"checking for update"); 
    NSData *plistData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://example.com/MyApp.plist"]]; 
    if (plistData) { 
        NSLog(@"finished checking for update"); 
        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 update is available"); 
          UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Update available" message:@"A new update is available." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"UPDATE", nil]; 
          [alert show]; 
         }  
        } 
    } 
    

    가 그럼 난 내 UIAlertView의 위임 방법을 [경고 표시]는 didFinish 응용 프로그램에서 호출하면 안되지만 나중에 변경하겠습니다.

  • plistData가 얼마나 빨리 다운로드되고이 다운로드가 앱에 미치는 영향에 대해 잘 모릅니다.
  • 더 중요한 것은 내 경고보기 대리자 메서드가 작동하지 않고 업데이트가 다운로드되지 않는다는 것입니다. @property (nonatomic, strong) UIWebView * webView를 사용하여 webView를 소개하더라도이 메서드는 아무 것도하지 않습니다.
  • Google 크롬을 통해 .ipa를 다운로드 할 수 있으므로 Dropbox에 MIME이 올바르게 구성되어 있다고 생각합니다.

그래서 정말 필요한 href가있는 HTML에 도청 사용자의 행동을 복제 할 수있는 NSURLConnection을 사용하여 방법 (NSURLRequest 등)입니다. 그 후 나는 전체 업데이트가 발생할 것이라고 생각합니다.

당신은 자동으로 아이튠즈 뮤직 스토어 - 서비스 작동하는지 모르겠어요

[[UIApplication sharedApplication] openURL:...]; 

사용하여 URL 열 수 있습니다

답변

5

: URL을하지만 전화와 같은 다른 맞춤 URL 체계 :, FB 작동 : 등 때문에 애플이 특별히 차단하지 않았다면 그렇게해야한다.

+1

Apple은이 방법으로 itms-services를 사용하여 차단을 시작한 것으로 보입니다. 다행스럽게도 사용자는 itms-services와 관련된 href 링크를 누를 것을 요청받을 수 있습니다. –

+0

또한 앱 내에서 itms-services URL을 여는 데 실패했습니다. 사용자가 웹 페이지에서 다운로드 버튼을 찾아서 누르기위한 몇 가지 여분의 탭을 의미합니다. 어쨌든 웹 페이지에서이 작업을 수행 할 수있는 이유는 무엇입니까? –

+0

이것은 시뮬레이터에서는 작동하지 않지만 실제 장치에서는 문제가 없습니다. 잠시 혼란 스러웠다. –