date - iOS Enterprise App Distribution – Provisioning Profile expired -
how can check in app when expired provisioning profile , notify user date?
i have found here. file not included in bundle of project. maybe there options? thanks
despite being mac os x prov checker, applies same ios too:
https://github.com/ligeiarowena/provisioninginfo
personally, information shouldn't bother users. should have clear record of when expire, , notify users via push notifications and/or form of rest api expiration dates.
ideally, best way handle periodically (at least once year) push out update nothing more new embedded mprov.
do need users notify when provisioning profiles expiring?
but in terms of reading plist file:
[nsdictionary dictionarywithcontentsoffile:@"path/to/file.plist"]
this seems answered question at:
get expiration date of provisioning profile @ run-time?
but reiterate code:
- (nsstring*) getexpiry{ nsstring *profilepath = [[nsbundle mainbundle] pathforresource:@"embedded" oftype:@"mobileprovision"]; // check provisioning profile existence if (profilepath) { // hex representation nsdata *profiledata = [nsdata datawithcontentsoffile:profilepath]; nsstring *profilestring = [nsstring stringwithformat:@"%@", profiledata]; // remove brackets @ beginning , 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 readable characters nsmutablestring *profiletext = [nsmutablestring new]; (int = 0; < profilestring.length; += 2) { nsstring *hexchar = [profilestring substringwithrange:nsmakerange(i, 2)]; int value = 0; sscanf([hexchar cstringusingencoding:nsasciistringencoding], "%x", &value); [profiletext appendformat:@"%c", (char)value]; } // remove whitespaces , new lines characters nsarray *profilewords = [profiletext componentsseparatedbycharactersinset:[nscharacterset whitespaceandnewlinecharacterset]]; //there must better word search through structure! need 'date' sibling <key>expirationdate</key>, or use regex bool sibling = false; (nsstring* word in profilewords){ if ([word isequaltostring:@"<key>expirationdate</key>"]){ nslog(@"got key, need date!"); sibling = true; } if (sibling && ([word rangeofstring:@"<date>"].location != nsnotfound)) { nslog(@"found it, win!"); nslog(@"expires: %@",word); return word; } } } return @""; }
Comments
Post a Comment