ios獲取和保存設備uuid

獲取設備uuid

NSString *vendor = [[UIDevice currentDevice].identifierForVendor UUIDString];



當通常我們如果app重裝之後uuid會改變,所以我們需要把它保存在鑰匙串內

NSString * deviceVendor = [[GSKeychain systemKeychain]secretForKey:@"XXX"];          //xxx表示是工程名稱     從鑰匙串中讀取uuid
    if(!deviceVendor)
    {
        [[GSKeychain systemKeychain]setSecret:vendor forKey:@"XXX"];
        deviceVendor = [[GSKeychain systemKeychain]secretForKey:@"XXX"];
        NSLog(@"shareVC保存vendor:%@",deviceVendor);
    }
    else
    {
        NSLog(@"shareVC獲取vendor:%@",deviceVendor);
    }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章