(绝对有用)iOS获取UUID,并使用keychain存储
来源:互联网 发布:python编程 第三版 编辑:程序博客网 时间:2024/06/08 05:14
#import 尖括号(Foundation/Foundation.h)
@interface UUID : NSObject
+(NSString *)getUUID;
@end
#import "UUID.h"
#import
#import "KeychainItemWrapper.h"
@implementation UUID
+(NSString *)getUUID
{
}
@end
第二个类是苹果官方的一个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
KeychainItemWrapper.h中的代码:
#import 尖括号(UIKit/UIKit.h)
@interface KeychainItemWrapper : NSObject
{
}
@property (nonatomic, retain) NSMutableDictionary *keychainItemData;
@property (nonatomic, retain) NSMutableDictionary *genericPasswordQuery;
- (id)initWithIdentifier: (NSString *)identifier accessGroup:(NSString *) accessGroup;
- (void)setObject:(id)inObject forKey:(id)key;
- (id)objectForKey:(id)key;
- (void)resetKeychainItem;
@end
KeychainItemWrapper.m中的代码:
#import "KeychainItemWrapper.h"
#import 尖括号(Security/Security.h)
@interface KeychainItemWrapper (PrivateMethods)
- (NSMutableDictionary *)secItemFormatToDictionar
- (NSMutableDictionary *)dictionaryToSecItemForma
- (void)writeToKeychain;
@end
@implementation KeychainItemWrapper
@synthesize keychainItemData, genericPasswordQuery;
- (id)initWithIdentifier: (NSString *)identifier accessGroup:(NSString *) accessGroup;
{
[genericPasswordQuery setObject:(id)CFBridgingRelease(kSecClassGenericPassword
if (accessGroup != nil)
{
#if TARGET_IPHONE_SIMULATOR
#else
[genericPasswordQuery setObject:accessGroup forKey:(id)kSecAttrAccessGroup];
#endif
}
[keychainItemData setObject:identifier forKey:(id)kSecAttrGeneric];
if (accessGroup != nil)
{
#if TARGET_IPHONE_SIMULATOR
#else
[keychainItemData setObject:accessGroup forKey:(id)kSecAttrAccessGroup];
#endif
}
}
[outDictionary release];
return self;
}
- (void)dealloc
{
[super dealloc];
}
- (void)setObject:(id)inObject forKey:(id)key
{
}
- (id)objectForKey:(id)key
{
}
- (void)resetKeychainItem
{
OSStatus junk = noErr;
junk = SecItemDelete((CFDictionaryRef)tempDictionary);
}
- (NSMutableDictionary *)dictionaryToSecItemForma
{
}
- (NSMutableDictionary *)secItemFormatToDictionar
{
return returnDictionary;
}
- (void)writeToKeychain
{
OSStatus result;
#if TARGET_IPHONE_SIMULATOR
[tempCheck removeObjectForKey:(id)kSecAttrAccessGroup];
#endif
NSAssert( result == noErr, @"Couldn't update the Keychain Item." );
NSAssert( result == noErr, @"Couldn't add the Keychain Item." );
}
@end
- (绝对有用)iOS获取UUID,并使用keychain存储
- (绝对有用)iOS获取UUID,并使用keychain存储
- (绝对有用)iOS获取UUID,并使用keychain存储
- (绝对有用)iOS获取UUID,并使用keychain存储(转载)
- (绝对有用)iOS获取UUID,并使用keychain存储
- iOS获取UUID,并使用keychain存储
- iOS获取UUID,并使用keychain存储
- iOS获取UUID,并使用keychain存储
- iOS获取UUID,并使用keychain存储
- iOS获取UUID,并使用keychain存储
- iOS获取UUID,并使用keychain存储
- iOS获取UUID,并使用keychain存储
- iOS获取UUID,并使用keychain存储
- iOS开发-基础:获取设备UUID,并使用keychain存储
- iOS获取UUID,并使用keychain存储,将账号密码存到keychain中
- iOS获取UUID,并使用keychain存储,可用于封设备
- iOS UUID +Keychain 存储
- 获取UUID及keychain存储
- linux平台C++开发基本知识
- linux之FTP
- DB2数值函数简介及使用
- 搜索引擎会通过日志文件把用户每次检索使用的所有检索串都记录下来,每个查询串的长度为1-255字节。 假设目前有一千万个记录(这些查询串的重复度比较高, 虽然总数是1千万,但如果除去重复后,不超过3百
- [LeetCode 322] Coin Change
- (绝对有用)iOS获取UUID,并使用keychain存储
- c++多态性
- HI3516A/Hi3516D H265流结构分析
- Linux中的ls命令详解
- Faster R-CNN:Towards Real-Time Object Detection with Region Proposal Networks
- 喜馬拉雅FM建立“學佛答問”專輯
- 添加自定义VC资源
- 关于Spring3 + Mybatis3整合时,多数据源动态切换的问题
- 还是string和char