app可以获取设备号吗 ios
2016-02-17 18:03:32 lvchaman 阅读数 606

通过使用keychain +uuid:可以实现,应用安装后,再卸载再安装都保证设备号的唯一性


- (void)viewDidLoad {

    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self setKeyChainValue];
}
- (void)setKeyChainValue{
    KeychainItemWrapper * keyChainItem = [[KeychainItemWrapper alloc] initWithIdentifier:@"TjjTestKeychain" accessGroup:@"QEW2Q234R5.com.jar.TjjTestKeychain"];
    _strUUID = [keyChainItem objectForKey:(__bridge id)(kSecValueData)];
    NSLog(@"uuid-->%@",_strUUID);
    //首次执行该方法时, uuid为空
    if (_strUUID == nil || [_strUUID isEqualToString:@""]) {
        [keyChainItem setObject:[self gen_uuid] forKey:(__bridge id)kSecValueData];
    }
    NSLog(@"---keyChainItem------>%@",keyChainItem);
    NSLog(@"---strUUID--->%@",_strUUID);
    _contentLabel.text = _strUUID;

}


准备前提:

1:#import "KeychainItemWrapper.h" //苹果官方的一个Demo里封装的,Demo的下载地址:http://developer.apple.com/library/ios/#samplecode/GenericKeychain/Listings/Classes_KeychainItemWrapper_h.html#//apple_ref/doc/uid/DTS40007797-Classes_KeychainItemWrapper_h-DontLinkElementID_9

2:引用系统库:security.framework

3:KeychainItemWrapper.h是mrc,如果在arc中引用,需要在build phases--》compile sources 里的对应文件加上“-fno-objc-arc”

4:添加文件.entitlements,创建array类型的Keychain Access Groups值为$(AppIdentifierPrefix)com.jar.TjjTestKeychain  ,然后buildSetting的code signing的code signing entitlements里填写路径   TjjTestKeychain/TestKeychain.entitlements【也可以点击Targets---》capabilities-->然后开启Keychain Sharing】


参考链接

http://blog.sina.com.cn/s/blog_5971cdd00102vqgy.html

http://www.jianshu.com/p/b83b0240bd0e


2016-03-03 19:42:00 weixin_33802505 阅读数 19

原文链接:http://www.jianshu.com/p/8ea7d9f1781f

if([platformisEqualToString:@"iPhone1,1"])return@"iPhone 2G (A1203)";if([platformisEqualToString:@"iPhone1,2"])return@"iPhone 3G (A1241/A1324)";if([platformisEqualToString:@"iPhone2,1"])return@"iPhone 3GS (A1303/A1325)";if([platformisEqualToString:@"iPhone3,1"])return@"iPhone 4 (A1332)";if([platformisEqualToString:@"iPhone3,2"])return@"iPhone 4 (A1332)";if([platformisEqualToString:@"iPhone3,3"])return@"iPhone 4 (A1349)";if([platformisEqualToString:@"iPhone4,1"])return@"iPhone 4S (A1387/A1431)";if([platformisEqualToString:@"iPhone5,1"])return@"iPhone 5 (A1428)";if([platformisEqualToString:@"iPhone5,2"])return@"iPhone 5 (A1429/A1442)";if([platformisEqualToString:@"iPhone5,3"])return@"iPhone 5c (A1456/A1532)";if([platformisEqualToString:@"iPhone5,4"])return@"iPhone 5c (A1507/A1516/A1526/A1529)";if([platformisEqualToString:@"iPhone6,1"])return@"iPhone 5s (A1453/A1533)";if([platformisEqualToString:@"iPhone6,2"])return@"iPhone 5s (A1457/A1518/A1528/A1530)";if([platformisEqualToString:@"iPhone7,1"])return@"iPhone 6 Plus (A1522/A1524)";if([platformisEqualToString:@"iPhone7,2"])return@"iPhone 6 (A1549/A1586)";if([platformisEqualToString:@"iPod1,1"])return@"iPod Touch 1G (A1213)";if([platformisEqualToString:@"iPod2,1"])return@"iPod Touch 2G (A1288)";if([platformisEqualToString:@"iPod3,1"])return@"iPod Touch 3G (A1318)";if([platformisEqualToString:@"iPod4,1"])return@"iPod Touch 4G (A1367)";if([platformisEqualToString:@"iPod5,1"])return@"iPod Touch 5G (A1421/A1509)";if([platformisEqualToString:@"iPad1,1"])return@"iPad 1G (A1219/A1337)";if([platformisEqualToString:@"iPad2,1"])return@"iPad 2 (A1395)";if([platformisEqualToString:@"iPad2,2"])return@"iPad 2 (A1396)";if([platformisEqualToString:@"iPad2,3"])return@"iPad 2 (A1397)";if([platformisEqualToString:@"iPad2,4"])return@"iPad 2 (A1395+New Chip)";if([platformisEqualToString:@"iPad2,5"])return@"iPad Mini 1G (A1432)";if([platformisEqualToString:@"iPad2,6"])return@"iPad Mini 1G (A1454)";if([platformisEqualToString:@"iPad2,7"])return@"iPad Mini 1G (A1455)";if([platformisEqualToString:@"iPad3,1"])return@"iPad 3 (A1416)";if([platformisEqualToString:@"iPad3,2"])return@"iPad 3 (A1403)";if([platformisEqualToString:@"iPad3,3"])return@"iPad 3 (A1430)";if([platformisEqualToString:@"iPad3,4"])return@"iPad 4 (A1458)";if([platformisEqualToString:@"iPad3,5"])return@"iPad 4 (A1459)";if([platformisEqualToString:@"iPad3,6"])return@"iPad 4 (A1460)";if([platformisEqualToString:@"iPad4,1"])return@"iPad Air (A1474)";if([platformisEqualToString:@"iPad4,2"])return@"iPad Air (A1475)";if([platformisEqualToString:@"iPad4,3"])return@"iPad Air (A1476)";if([platformisEqualToString:@"iPad4,4"])return@"iPad Mini 2G (A1489)";if([platformisEqualToString:@"iPad4,5"])return@"iPad Mini 2G (A1490)";if([platformisEqualToString:@"iPad4,6"])return@"iPad Mini 2G (A1491)";if([platformisEqualToString:@"i386"])return@"iPhone Simulator";if([platformisEqualToString:@"x86_64"])return@"iPhone Simulator";return platform;}
2016-05-19 11:18:00 weixin_33875839 阅读数 10

IOS下的APP里可以使用JPG格式的图片吗?有开发告诉说只能使用PNG格式的图片资源

一般都使用png格式的,jpg的一般指用作背景。
只是使用PNG效率高

IOS开发中图片资源使用png还是jpg格式

对于iOS本地应用程序来说最简单的答案就是始终使用PNG,除非你有非常非常好的理由不用它。当iOS应用构建的时候,Xcode会通过一种方式优化.png文件而不会优化其它文件格式。它优化得相当的好
他们之间有以下区别:
1.同个分辨率的图片,保存为png要比jpg大;
2.png图片有alpha通道,因此它支持图片透明,这点在ios开发中尤为重要;而jpg不支持透明
3.xcode会对png格式进行特殊的优化处理,而对于其他图片不做处理
总结一下有以下几点:
1.如果你的图片都是xcode本地就有,那就用png;如果图片是从网络上下载的,考虑到流量以及速度,可以考虑用jpg因为它具有较高的压缩率
2.本地的png优化由xcode帮你做;其他格式的需要在程序运行时做优化,更耗性能
3.如果你的图片要求有较高的色彩饱和度、图像质量,那就用jpg

2017-05-28 10:47:00 weixin_34227447 阅读数 7

获取iPhone设备码代码如下:

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *detailConstraint;// xib - 约束
//在适当的地方,添加如下代码,对约束进行修改
_detailConstraint.constant = 45;//修改约束
2016-01-28 17:03:10 yy1992320 阅读数 132
  1. NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];  
  2. NSString *name = [infoDictionary objectForKey:@"CFBundleDisplayName"];  
  3. NSString *version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];  
  4. NSString *build = [infoDictionary objectForKey:@"CFBundleVersion"];  
  5. NSString *label = [NSString stringWithFormat:@"%@ v%@ (build %@)", name, version, build];  
  6.   
  7. NSLog(@"%@",label)

获取IOS APP Icon

阅读数 2

为什么80%的码农都做不了架构师?>>>...

博文 来自: weixin_34238642

获取app的版本号,名称等

博文 来自: QL_ProCareer

ios获取app版本号

阅读数 809

获取iOS app资源

阅读数 447

没有更多推荐了,返回首页