美文网首页
获取ios应用的相关配置信息

获取ios应用的相关配置信息

作者: 杨闯 | 来源:发表于2019-02-03 14:39 被阅读6次
    - (void)isFromJailbrokenChannel
    {
        //取出embedded.mobileprovision这个描述文件的内容进行判断
        NSString *mobileProvisionPath = [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"];
        NSData *rawData = [NSData dataWithContentsOfFile:mobileProvisionPath];
        NSString *rawDataString = [[NSString alloc] initWithData:rawData encoding:NSASCIIStringEncoding];
        NSRange plistStartRange = [rawDataString rangeOfString:@"<plist"];
        NSRange plistEndRange = [rawDataString rangeOfString:@"</plist>"];
        if (plistStartRange.location != NSNotFound && plistEndRange.location != NSNotFound) {
            NSString *tempPlistString = [rawDataString substringWithRange:NSMakeRange(plistStartRange.location, NSMaxRange(plistEndRange))];
            NSData *tempPlistData = [tempPlistString dataUsingEncoding:NSUTF8StringEncoding];
            NSDictionary *plistDic =  [NSPropertyListSerialization propertyListWithData:tempPlistData options:NSPropertyListImmutable format:nil error:nil];
            NSLog(@"%@",plistDic);
        }
    }
    

    相关文章

      网友评论

          本文标题:获取ios应用的相关配置信息

          本文链接:https://www.haomeiwen.com/subject/jguihftx.html