zoukankan      html  css  js  c++  java
  • 获取App中的embedded.mobileprovision判断teamID

    U9YJ289VCA

    NSString *mobileProvisionPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"embedded.mobileprovision"];
        FILE *fp=fopen([mobileProvisionPath UTF8String],"r");
        char ch;
        if(fp==NULL) {
            printf("file cannot be opened/n");
        }
        NSMutableString *str = [NSMutableString string];
        while((ch=fgetc(fp))!=EOF) {
            [str appendFormat:@"%c",ch];
        }
        fclose(fp);
        
        NSString *teamIdentifier = nil;
        NSRange teamIdentifierRange = [str rangeOfString:@"<key>com.apple.developer.team-identifier</key>"];
        if (teamIdentifierRange.location != NSNotFound) {
            NSInteger location = teamIdentifierRange.location + teamIdentifier.length;
            NSInteger length = [str length] - location;
            if (length > 0 && location >= 0) {
                NSString *newStr = [str substringWithRange:NSMakeRange(location, length)];;
                NSArray *val = [newStr componentsSeparatedByString:@"</string>"];
                NSString *v = [val firstObject];
                NSRange startRange = [v rangeOfString:@"<string>"];
                
                NSInteger newLocation = startRange.location + startRange.length;
                NSInteger newLength = [v length] - newLocation;
                if (newLength > 0 && location >= 0) {
                    teamIdentifier = [v substringWithRange:NSMakeRange(newLocation, newLength)];
                }
            }
        }
        NSLog(@"%@", teamIdentifier);
  • 相关阅读:
    hibernate入门
    struts文件上传
    Struts的增删改查
    struts入门
    Maven配置以及环境搭配
    layui增删改查
    easyui三
    A
    C. Permutation Cycle
    E
  • 原文地址:https://www.cnblogs.com/huangzizhu/p/9361070.html
Copyright © 2011-2022 走看看