gpt4 book ai didi

iOS Enterprise App Distribution – Provisioning Profile 已过期

转载 作者:行者123 更新时间:2023-11-29 01:56:43 24 4
gpt4 key购买 nike

我如何在配置文件过期时 checkin 应用程序并通知用户有关日期?

Example

我在这里找到了。但是这个文件不包含在项目的包中。也许有一些选择?谢谢

最佳答案

尽管这是一个 MAC OS X prov 检查器,它也同样适用于 iOS:

https://github.com/LigeiaRowena/ProvisioningInfo

就个人而言,这些信息不应打扰您的用户。您应该清楚地记录它们何时过期,并通过推送通知和/或某种形式的 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 @"";
}

关于iOS Enterprise App Distribution – Provisioning Profile 已过期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30758795/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com