2015-06-10 3 views
0

Как я могу проверить приложение, когда истек Профилирование профиля и сообщить пользователю о дате?Распределение приложений для корпоративных приложений iOS - срок действия профайла устарел

Example

Я нашел здесь. Но этот файл не включен в пакет проекта. Может быть, есть некоторые варианты? Благодаря

ответ

1

Несмотря на это будучи пров проверки MAC OS X, он применяет все равно прошивкой тоже:

https://github.com/LigeiaRowena/ProvisioningInfo

Лично, эта информация не должна беспокоить пользователей. У вас должна быть четкая запись, когда они истекают, и уведомлять пользователей посредством push-уведомлений и/или какой-либо формы REST api для дат истечения срока действия.

В идеале лучший способ справиться с этим - периодически (не реже одного раза в год) выталкивать обновление с помощью всего лишь нового встроенного mprov.

Вам нужно, чтобы ваши пользователи уведомляли вас о том, когда истекают профили подготовки?

Но с точки зрения чтения файла Plist:

[NSDictionary dictionaryWithContentsOfFile:@"path/to/file.plist"] 

Это также, кажется, ранее, отвечая на вопрос по адресу:

Get the EXPIRATION date of a Provisioning Profile at Run-time?

но подтвердить код:

- (NSString*) getExpiry{ 

    NSString *profilePath = [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]; 
    // Check provisioning profile existence 
    if (profilePath) 
    { 
     // Get hex representation 
     NSData *profileData = [NSData dataWithContentsOfFile:profilePath]; 
     NSString *profileString = [NSString stringWithFormat:@"%@", profileData]; 

     // Remove brackets at beginning and end 
     profileString = [profileString stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:@""]; 
     profileString = [profileString stringByReplacingCharactersInRange:NSMakeRange(profileString.length - 1, 1) withString:@""]; 

     // Remove spaces 
     profileString = [profileString stringByReplacingOccurrencesOfString:@" " withString:@""]; 


     // Convert hex values to readable characters 
     NSMutableString *profileText = [NSMutableString new]; 
     for (int i = 0; i < profileString.length; i += 2) 
     { 
      NSString *hexChar = [profileString substringWithRange:NSMakeRange(i, 2)]; 
      int value = 0; 
      sscanf([hexChar cStringUsingEncoding:NSASCIIStringEncoding], "%x", &value); 
      [profileText appendFormat:@"%c", (char)value]; 
     } 

     // Remove whitespaces and new lines characters 
     NSArray *profileWords = [profileText componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 

     //There must be a better word to search through this as a structure! Need 'date' sibling to <key>ExpirationDate</key>, or use regex 
     BOOL sibling = false; 
     for (NSString* word in profileWords){ 
      if ([word isEqualToString:@"<key>ExpirationDate</key>"]){ 
       NSLog(@"Got to the key, now need the date!"); 
       sibling = true; 
      } 
      if (sibling && ([word rangeOfString:@"<date>"].location != NSNotFound)) { 
       NSLog(@"Found it, you win!"); 
       NSLog(@"Expires: %@",word); 
       return word; 
      } 
     } 

    } 

    return @""; 
} 
Смежные вопросы