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);
  • 相关阅读:
    面试题总结
    h5c3新特性
    redis常用命令大全
    windows下挂载linux的nfs网络硬盘
    mysql之char、varchar、text对比
    Lua与C的交互
    通信模型socket
    程序编译流程
    区块链共识机制(POW、POS、DPOS等)的优缺点
    .net c#获取自定义Attribute
  • 原文地址:https://www.cnblogs.com/huangzizhu/p/9361070.html
Copyright © 2011-2022 走看看