Commit a7a9ffbc25094d0fcf3c9270175b8b9152fe256a
1 parent
2e268434
更改存储uid到钥匙串
Showing
11 changed files
with
309 additions
and
387 deletions
CNLiveUserSystemDemo.xcodeproj/project.pbxproj
| ... | ... | @@ -83,6 +83,7 @@ |
| 83 | 83 | B6B54BEA1D8D009800089C9C /* UserInfoHeaderImageTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B54BE91D8D009800089C9C /* UserInfoHeaderImageTableViewCell.m */; }; |
| 84 | 84 | B6B54BED1D8D011000089C9C /* UserInfoTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B54BEC1D8D011000089C9C /* UserInfoTableViewCell.m */; }; |
| 85 | 85 | B6B54BF01D8D025A00089C9C /* ModifyUserInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B54BEF1D8D025A00089C9C /* ModifyUserInfoViewController.m */; }; |
| 86 | + D23A472722D48B8C00A4B465 /* NSString+Keychain.m in Sources */ = {isa = PBXBuildFile; fileRef = D23A472522D48B8C00A4B465 /* NSString+Keychain.m */; }; | |
| 86 | 87 | D273A1DC1ED7CC9D00AE3F35 /* CNLiveEmailModifyPassword.m in Sources */ = {isa = PBXBuildFile; fileRef = D273A1DB1ED7CC9D00AE3F35 /* CNLiveEmailModifyPassword.m */; }; |
| 87 | 88 | D273A1DF1ED7F81E00AE3F35 /* CNLiveCheckVerificationCode.m in Sources */ = {isa = PBXBuildFile; fileRef = D273A1DE1ED7F81E00AE3F35 /* CNLiveCheckVerificationCode.m */; }; |
| 88 | 89 | D2D25B171ED94BCE00B4B18B /* EmailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2D25B161ED94BCE00B4B18B /* EmailViewController.m */; }; |
| ... | ... | @@ -255,6 +256,8 @@ |
| 255 | 256 | B6B54BEC1D8D011000089C9C /* UserInfoTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserInfoTableViewCell.m; sourceTree = "<group>"; }; |
| 256 | 257 | B6B54BEE1D8D025A00089C9C /* ModifyUserInfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModifyUserInfoViewController.h; sourceTree = "<group>"; }; |
| 257 | 258 | B6B54BEF1D8D025A00089C9C /* ModifyUserInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModifyUserInfoViewController.m; sourceTree = "<group>"; }; |
| 259 | + D23A472522D48B8C00A4B465 /* NSString+Keychain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Keychain.m"; sourceTree = "<group>"; }; | |
| 260 | + D23A472622D48B8C00A4B465 /* NSString+Keychain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Keychain.h"; sourceTree = "<group>"; }; | |
| 258 | 261 | D273A1DA1ED7CC9D00AE3F35 /* CNLiveEmailModifyPassword.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveEmailModifyPassword.h; sourceTree = "<group>"; }; |
| 259 | 262 | D273A1DB1ED7CC9D00AE3F35 /* CNLiveEmailModifyPassword.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveEmailModifyPassword.m; sourceTree = "<group>"; }; |
| 260 | 263 | D273A1DD1ED7F81E00AE3F35 /* CNLiveCheckVerificationCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveCheckVerificationCode.h; sourceTree = "<group>"; }; |
| ... | ... | @@ -517,6 +520,8 @@ |
| 517 | 520 | 812642F71D86A7E500B402CA /* CNLiveUserSystemSDK */ = { |
| 518 | 521 | isa = PBXGroup; |
| 519 | 522 | children = ( |
| 523 | + D23A472622D48B8C00A4B465 /* NSString+Keychain.h */, | |
| 524 | + D23A472522D48B8C00A4B465 /* NSString+Keychain.m */, | |
| 520 | 525 | 812642F81D86A83100B402CA /* CNLiveUserSystemCenter.h */, |
| 521 | 526 | 812642F91D86A83100B402CA /* CNLiveUserSystemCenter.m */, |
| 522 | 527 | 8187A8FC1D8E90C5007FAFB6 /* CNLiveUserManager.h */, |
| ... | ... | @@ -693,6 +698,7 @@ |
| 693 | 698 | developmentRegion = English; |
| 694 | 699 | hasScannedForEncodings = 0; |
| 695 | 700 | knownRegions = ( |
| 701 | + English, | |
| 696 | 702 | en, |
| 697 | 703 | Base, |
| 698 | 704 | ); |
| ... | ... | @@ -766,6 +772,7 @@ |
| 766 | 772 | 8116F8F11D891BCD0084FE49 /* RegistBasicInformationView.m in Sources */, |
| 767 | 773 | 8187A8F61D8E6486007FAFB6 /* NSObject+UserModel.m in Sources */, |
| 768 | 774 | 811600F11D927E7E003CAE7D /* SDWebImageCompat.m in Sources */, |
| 775 | + D23A472722D48B8C00A4B465 /* NSString+Keychain.m in Sources */, | |
| 769 | 776 | 811600F31D927E7E003CAE7D /* SDWebImageDownloader.m in Sources */, |
| 770 | 777 | 811600F41D927E7E003CAE7D /* SDWebImageDownloaderOperation.m in Sources */, |
| 771 | 778 | 811600F21D927E7E003CAE7D /* SDWebImageDecoder.m in Sources */, |
| ... | ... | @@ -974,7 +981,7 @@ |
| 974 | 981 | "-fobjc-arc", |
| 975 | 982 | "-ObjC", |
| 976 | 983 | ); |
| 977 | - PRODUCT_BUNDLE_IDENTIFIER = "shixunzhongguo-cnlive"; | |
| 984 | + PRODUCT_BUNDLE_IDENTIFIER = "shixunzhongguo-cnlive8"; | |
| 978 | 985 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 979 | 986 | PROVISIONING_PROFILE = ""; |
| 980 | 987 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| ... | ... | @@ -1007,7 +1014,7 @@ |
| 1007 | 1014 | "-fobjc-arc", |
| 1008 | 1015 | "-ObjC", |
| 1009 | 1016 | ); |
| 1010 | - PRODUCT_BUNDLE_IDENTIFIER = "shixunzhongguo-cnlive"; | |
| 1017 | + PRODUCT_BUNDLE_IDENTIFIER = "shixunzhongguo-cnlive8"; | |
| 1011 | 1018 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 1012 | 1019 | PROVISIONING_PROFILE = ""; |
| 1013 | 1020 | PROVISIONING_PROFILE_SPECIFIER = ""; | ... | ... |
CNLiveUserSystemDemo/AppDelegate.m
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { |
| 21 | - | |
| 21 | + | |
| 22 | 22 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
| 23 | 23 | ViewController *vc = [[ViewController alloc] init]; |
| 24 | 24 | UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc]; |
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | [WXApi registerApp:WeChatAppKey]; |
| 31 | 31 | [WeiboSDK enableDebugMode:YES]; |
| 32 | 32 | [WeiboSDK registerApp:SinaAppKey]; |
| 33 | - | |
| 33 | + NSLog(@"111didFinishLaunchingWithOptions"); | |
| 34 | 34 | return YES; |
| 35 | 35 | } |
| 36 | 36 | |
| ... | ... | @@ -60,6 +60,7 @@ |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | - (void)applicationDidBecomeActive:(UIApplication *)application { |
| 63 | + NSLog(@"111applicationDidBecomeActive"); | |
| 63 | 64 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. |
| 64 | 65 | } |
| 65 | 66 | ... | ... |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserManager.m
| ... | ... | @@ -81,6 +81,7 @@ |
| 81 | 81 | stamp = [stamp stringByReplacingOccurrencesOfString:@"." withString:@""]; |
| 82 | 82 | NSString *baseUrl = formalStatUrl; |
| 83 | 83 | NSString *vvUrl = [NSString stringWithFormat:@"%@?sver=%@&uid=%@&tm=%@&from=apple&spid=&appid=%@&version=1005_%@&eventid=1320&uri=&sid=%@&plat=i_%@&objid=",baseUrl,kSVer,[CNLiveUserSystemTools uidForStat:realTime],stamp,self.appId,SDKVersion, [CNLiveUserManager manager].userId ? [CNLiveUserManager manager].userId: @"",StatAppVersion]; |
| 84 | + NSLog(@"url start:\n%@",vvUrl); | |
| 84 | 85 | [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:vvUrl]] delegate:nil]; |
| 85 | 86 | |
| 86 | 87 | }]; |
| ... | ... | @@ -101,6 +102,7 @@ |
| 101 | 102 | |
| 102 | 103 | |
| 103 | 104 | NSString *vvUrl = [NSString stringWithFormat:@"%@?sver=%@&uid=%@&tm=%@&from=apple&spid=&appid=%@&version=1005_%@&eventid=1321&uri=%@&sid=%@&plat=i_%@&objid=",baseUrl,kSVer,[CNLiveUserSystemTools uidForStat:realTime],stamp,self.appId,SDKVersion,endDate,[CNLiveUserManager manager].userId ? [CNLiveUserManager manager].userId: @"",StatAppVersion]; |
| 105 | + NSLog(@"url end:\n%@",vvUrl); | |
| 104 | 106 | [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:vvUrl]] delegate:nil]; |
| 105 | 107 | }]; |
| 106 | 108 | } | ... | ... |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemTools.m
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | #import "CommonCrypto/CommonDigest.h" |
| 12 | 12 | #import "Common.h" |
| 13 | 13 | #import "CNLiveUserManager.h" |
| 14 | +#import "NSString+Keychain.h" | |
| 14 | 15 | |
| 15 | 16 | #define testStatUrl @"http://app.sta.cnlive.com/app.jpg" |
| 16 | 17 | #define formalStatUrl @"http://app.sta.cnlive.com/app.jpg" |
| ... | ... | @@ -25,23 +26,27 @@ |
| 25 | 26 | |
| 26 | 27 | NSUserDefaults *defauts = [NSUserDefaults standardUserDefaults]; |
| 27 | 28 | NSString *userKey = @"kCNLiveUserDefaultsUIDKey"; |
| 29 | +// [NSString xw_deletes]; | |
| 28 | 30 | if ([defauts objectForKey:userKey]) { |
| 31 | + //老用户升级新版本后,没删App | |
| 29 | 32 | uid = [[defauts objectForKey:userKey] copy]; |
| 33 | + NSArray <NSString *>*arr = [uid componentsSeparatedByString:@"_"]; | |
| 34 | + NSString *uuid = arr[0]; | |
| 35 | + NSString *ts = arr[1]; | |
| 36 | + [NSString xw_saveUUID:uuid TS:ts]; | |
| 37 | + return uid; | |
| 38 | + }else if (XW_UUID_Exist){//老用户,删了App | |
| 39 | + uid = XW_UUID_Timestamp(dateStr); | |
| 40 | + [defauts setObject:uid forKey:userKey]; | |
| 41 | + [defauts synchronize]; | |
| 30 | 42 | return uid; |
| 31 | 43 | } |
| 32 | 44 | else { |
| 33 | - | |
| 34 | - NSString *stamp = dateStr; | |
| 35 | - stamp = [stamp stringByReplacingOccurrencesOfString:@"." withString:@""]; | |
| 36 | - | |
| 37 | - NSString *idfv = [[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""]; | |
| 38 | - uid = [NSString stringWithFormat:@"%@_%@", idfv, stamp]; | |
| 39 | - | |
| 45 | + uid = XW_UUID_Timestamp(dateStr); | |
| 40 | 46 | [defauts setObject:uid forKey:userKey]; |
| 41 | 47 | [defauts synchronize]; |
| 48 | + return uid; | |
| 42 | 49 | } |
| 43 | - | |
| 44 | - return uid; | |
| 45 | 50 | } |
| 46 | 51 | |
| 47 | 52 | #pragma mark - 加密 | ... | ... |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/NSString+Keychain.h
0 → 100644
| 1 | +// | |
| 2 | +// NSString+Keychain.h | |
| 3 | +// XWTest | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/7/8. | |
| 6 | +// Copyright © 2019 CNLive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | + | |
| 11 | +// 获取UUID | |
| 12 | +#define XW_UUID [NSString xw_getUUIDInKeychain] | |
| 13 | +// 是否存在UUID | |
| 14 | +#define XW_UUID_Exist [NSString xw_existUUID] | |
| 15 | + | |
| 16 | +// 获取时间戳 | |
| 17 | +#define XW_Timestamp [NSString xw_getTimestampInKeychain] | |
| 18 | +// 是否存在时间戳 | |
| 19 | +#define XW_Timestamp_Exist [NSString xw_existTimestamp] | |
| 20 | + | |
| 21 | +// 获取UUID_时间戳 传入时间戳 | |
| 22 | +#define XW_UUID_Timestamp(Timestamp) [Timestamp xw_getUUIDTimestampInKeychain] | |
| 23 | + | |
| 24 | +NS_ASSUME_NONNULL_BEGIN | |
| 25 | + | |
| 26 | +@interface NSString (Keychain) | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * @abstract 获取设备UUID | |
| 30 | + * | |
| 31 | + * 本方法是得到 UUID 后存入系统中的 keychain 的方法 | |
| 32 | + * 程序删除后重装,仍可以得到相同的唯一标示 | |
| 33 | + * 但是当系统刷机后,系统中的钥匙串会被清空,此时本方法失效 | |
| 34 | + * | |
| 35 | + * @return 返回UUID字符串对象 | |
| 36 | + */ | |
| 37 | ++ (NSString *)xw_getUUIDInKeychain; | |
| 38 | ++ (BOOL)xw_existUUID; | |
| 39 | + | |
| 40 | + | |
| 41 | +/** | |
| 42 | + * @abstract 获取时间戳 | |
| 43 | + * 获取的时间戳就是第一次调用xw_getTimeInKeychain这个方法,此方法会把传入的时间戳存入系统中的 keychain | |
| 44 | + * 我们调用此方法获取时间戳的时候,如果有,则返回;如果没有,则返回当前时间戳 | |
| 45 | + * 一定确保此方法在xw_getTimeInKeychain之后调用 * | |
| 46 | + * | |
| 47 | + * @return 返回时间戳字符串对象 | |
| 48 | + */ | |
| 49 | ++ (NSString *)xw_getTimestampInKeychain; | |
| 50 | ++ (BOOL)xw_existTimestamp; | |
| 51 | + | |
| 52 | + | |
| 53 | +/** | |
| 54 | + * @abstract 获取UUID和_和时间戳3个的拼接对象 | |
| 55 | + * | |
| 56 | + * 本方法一定要使用时间戳字符串调用 * | |
| 57 | + * 本方法是得到 UUID_时间戳 后存入系统中的 keychain 的方法 | |
| 58 | + * 程序删除后重装,仍可以得到相同的唯一标示 | |
| 59 | + * 但是当系统刷机后,系统中的钥匙串会被清空,此时本方法失效 | |
| 60 | + * | |
| 61 | + * @return 返回获取UUID和_和时间戳3个的拼接对象 | |
| 62 | + */ | |
| 63 | +- (NSString *)xw_getUUIDTimestampInKeychain; | |
| 64 | + | |
| 65 | + | |
| 66 | +//保存数据至钥匙串中 | |
| 67 | ++ (void)xw_save:(NSString *)service data:(id)data; | |
| 68 | + | |
| 69 | + | |
| 70 | +//从钥匙串中加载数据 | |
| 71 | ++ (id)xw_load:(NSString *)service; | |
| 72 | + | |
| 73 | + | |
| 74 | +//删除数据 | |
| 75 | ++ (void)xw_delete:(NSString *)service; | |
| 76 | ++ (void)xw_deletes; | |
| 77 | + | |
| 78 | +/** | |
| 79 | + * 保存已有的UUID_TS到钥匙串 | |
| 80 | + * | |
| 81 | + * @param UUID UUID的字符串 | |
| 82 | + * @param TS TS的字符串 | |
| 83 | + */ | |
| 84 | ++ (void)xw_saveUUID:(NSString *)UUID TS:(NSString *)TS; | |
| 85 | + | |
| 86 | +@end | |
| 87 | + | |
| 88 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/NSString+Keychain.m
0 → 100644
| 1 | +// | |
| 2 | +// NSString+Keychain.m | |
| 3 | +// XWTest | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/7/8. | |
| 6 | +// Copyright © 2019 CNLive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "NSString+Keychain.h" | |
| 10 | +#import <Security/Security.h> | |
| 11 | + | |
| 12 | +NSString * const KEY_UUID_INSTEAD = @"com.cnlive.CNLiveNetAdd.uuid"; | |
| 13 | +NSString * const KEY_TIME_INSTEAD = @"com.cnlive.CNLiveNetAdd.time"; | |
| 14 | + | |
| 15 | +@implementation NSString (Keychain) | |
| 16 | +/** | |
| 17 | +* 保存已有的UUID_TS到钥匙串 | |
| 18 | +* | |
| 19 | +* @param UUID UUID的字符串 | |
| 20 | +* @param TS TS的字符串 | |
| 21 | +*/ | |
| 22 | ++ (void)xw_saveUUID:(NSString *)UUID TS:(NSString *)TS { | |
| 23 | + if (!XW_UUID_Exist || !XW_Timestamp_Exist) { | |
| 24 | + [NSString xw_save:KEY_UUID_INSTEAD data:UUID]; | |
| 25 | + [NSString xw_save:KEY_TIME_INSTEAD data:TS]; | |
| 26 | + } | |
| 27 | +} | |
| 28 | +/** | |
| 29 | + * @abstract 获取设备UUID | |
| 30 | + * | |
| 31 | + * 本方法是得到 UUID 后存入系统中的 keychain 的方法 | |
| 32 | + * 程序删除后重装,仍可以得到相同的唯一标示 | |
| 33 | + * 但是当系统刷机后,系统中的钥匙串会被清空,此时本方法失效 | |
| 34 | + * | |
| 35 | + * @return 返回UUID字符串对象 | |
| 36 | + */ | |
| 37 | ++ (NSString *)xw_getUUIDInKeychain { | |
| 38 | + NSString *getUDIDInKeychain = (NSString *)[NSString xw_load:KEY_UUID_INSTEAD]; | |
| 39 | + NSLog(@"最终 ———— UUID %@",getUDIDInKeychain); | |
| 40 | + return getUDIDInKeychain; | |
| 41 | + | |
| 42 | +} | |
| 43 | + | |
| 44 | ++ (BOOL)xw_existUUID{ | |
| 45 | + NSString *getUDIDInKeychain = (NSString *)[NSString xw_load:KEY_UUID_INSTEAD]; | |
| 46 | + NSLog(@"从keychain中获取到的 UUID %@",getUDIDInKeychain); | |
| 47 | + if (!getUDIDInKeychain ||[getUDIDInKeychain isEqualToString:@""]||[getUDIDInKeychain isKindOfClass:[NSNull class]]) { | |
| 48 | + return NO; | |
| 49 | + }else{ | |
| 50 | + return YES; | |
| 51 | + | |
| 52 | + } | |
| 53 | + | |
| 54 | +} | |
| 55 | + | |
| 56 | +/** | |
| 57 | + * @abstract 获取时间戳 | |
| 58 | + * 获取的时间戳就是第一次调用xw_getTimeInKeychain这个方法,此方法会把传入的时间戳存入系统中的 keychain | |
| 59 | + * 我们调用此方法获取时间戳的时候,如果有,则返回;如果没有,则返回当前时间戳 | |
| 60 | + * 一定确保此方法在xw_getTimeInKeychain之后调用 * | |
| 61 | + * | |
| 62 | + * @return 返回时间戳字符串对象 | |
| 63 | + */ | |
| 64 | ++ (NSString *)xw_getTimestampInKeychain { | |
| 65 | + NSString *getTimeInKeychain = (NSString *)[NSString xw_load:KEY_TIME_INSTEAD]; | |
| 66 | + return getTimeInKeychain; | |
| 67 | + | |
| 68 | +} | |
| 69 | + | |
| 70 | ++ (BOOL)xw_existTimestamp{ | |
| 71 | + NSString *getTimeInKeychain = (NSString *)[NSString xw_load:KEY_TIME_INSTEAD]; | |
| 72 | + NSLog(@"从keychain中获取到的 UUID %@",getTimeInKeychain); | |
| 73 | + if (!getTimeInKeychain ||[getTimeInKeychain isEqualToString:@""]||[getTimeInKeychain isKindOfClass:[NSNull class]]) { | |
| 74 | + return NO; | |
| 75 | + }else{ | |
| 76 | + return YES; | |
| 77 | + | |
| 78 | + } | |
| 79 | + | |
| 80 | +} | |
| 81 | + | |
| 82 | + | |
| 83 | +/** | |
| 84 | + * @abstract 获取UUID和_和时间戳3个的拼接对象 | |
| 85 | + * | |
| 86 | + * 本方法一定要使用时间戳字符串调用 * | |
| 87 | + * 本方法是得到 UUID_时间戳 后存入系统中的 keychain 的方法 | |
| 88 | + * 程序删除后重装,仍可以得到相同的唯一标示 | |
| 89 | + * 但是当系统刷机后,系统中的钥匙串会被清空,此时本方法失效 | |
| 90 | + * | |
| 91 | + * @return 返回获取UUID和_和时间戳3个的拼接对象 | |
| 92 | + */ | |
| 93 | +- (NSString *)xw_getUUIDTimestampInKeychain { | |
| 94 | + NSString *getUDIDInKeychain = (NSString *)[NSString xw_load:KEY_UUID_INSTEAD]; | |
| 95 | + NSLog(@"从keychain中获取到的 UUID %@",getUDIDInKeychain); | |
| 96 | + if (!getUDIDInKeychain ||[getUDIDInKeychain isEqualToString:@""]||[getUDIDInKeychain isKindOfClass:[NSNull class]]) { | |
| 97 | + CFUUIDRef puuid = CFUUIDCreate( nil ); | |
| 98 | + CFStringRef uuidString = CFUUIDCreateString( nil, puuid ); | |
| 99 | + NSString * idfv = (NSString *)CFBridgingRelease(CFStringCreateCopy( NULL, uuidString)); | |
| 100 | + NSString *result = [idfv stringByReplacingOccurrencesOfString:@"-" withString:@""]; | |
| 101 | + | |
| 102 | + CFRelease(puuid); | |
| 103 | + CFRelease(uuidString); | |
| 104 | + NSLog(@"\n \n \n _____重新存储 UUID_____\n \n \n %@",result); | |
| 105 | + [NSString xw_save:KEY_UUID_INSTEAD data:result]; | |
| 106 | + getUDIDInKeychain = (NSString *)[NSString xw_load:KEY_UUID_INSTEAD]; | |
| 107 | + } | |
| 108 | + | |
| 109 | + NSString *getTimeInKeychain = (NSString *)[NSString xw_load:KEY_TIME_INSTEAD]; | |
| 110 | + if (!getTimeInKeychain ||[getTimeInKeychain isEqualToString:@""]||[getTimeInKeychain isKindOfClass:[NSNull class]]) { | |
| 111 | + [NSString xw_save:KEY_TIME_INSTEAD data:self]; | |
| 112 | + getTimeInKeychain = (NSString *)[NSString xw_load:KEY_TIME_INSTEAD]; | |
| 113 | + } | |
| 114 | + | |
| 115 | + NSString *string = [NSString stringWithFormat:@"%@_%@",getUDIDInKeychain,getTimeInKeychain]; | |
| 116 | + NSLog(@"最终 ———— UUID_时间戳 %@",string); | |
| 117 | + return string; | |
| 118 | + | |
| 119 | +} | |
| 120 | + | |
| 121 | + | |
| 122 | +//保存数据至钥匙串中 | |
| 123 | ++ (void)xw_save:(NSString *)service data:(id)data { | |
| 124 | + //Get search dictionary | |
| 125 | + NSMutableDictionary *keychainQuery = [self getKeychainQuery:service]; | |
| 126 | + //Delete old item before add new item | |
| 127 | + SecItemDelete((CFDictionaryRef)keychainQuery); | |
| 128 | + //Add new object to search dictionary(Attention:the data format) | |
| 129 | + [keychainQuery setObject:[NSKeyedArchiver archivedDataWithRootObject:data] forKey:(id)kSecValueData]; | |
| 130 | + //Add item to keychain with the search dictionary | |
| 131 | + SecItemAdd((CFDictionaryRef)keychainQuery, NULL); | |
| 132 | + | |
| 133 | +} | |
| 134 | + | |
| 135 | + | |
| 136 | +//从钥匙串中加载数据 | |
| 137 | ++ (id)xw_load:(NSString *)service { | |
| 138 | + id ret = nil; | |
| 139 | + NSMutableDictionary *keychainQuery = [self getKeychainQuery:service]; | |
| 140 | + //Configure the search setting | |
| 141 | + //Since in our simple case we are expecting only a single attribute to be returned (the password) we can set the attribute kSecReturnData to kCFBooleanTrue | |
| 142 | + [keychainQuery setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnData]; | |
| 143 | + [keychainQuery setObject:(id)kSecMatchLimitOne forKey:(id)kSecMatchLimit]; | |
| 144 | + CFDataRef keyData = NULL; | |
| 145 | + if (SecItemCopyMatching((CFDictionaryRef)keychainQuery, (CFTypeRef *)&keyData) == noErr) { | |
| 146 | + @try { | |
| 147 | + ret = [NSKeyedUnarchiver unarchiveObjectWithData:(__bridge NSData *)keyData]; | |
| 148 | + } @catch (NSException *e) { | |
| 149 | + NSLog(@"Unarchive of %@ failed: %@", service, e); | |
| 150 | + } @finally { | |
| 151 | + } | |
| 152 | + } | |
| 153 | + if (keyData) | |
| 154 | + CFRelease(keyData); | |
| 155 | + return ret; | |
| 156 | + | |
| 157 | +} | |
| 158 | + | |
| 159 | + | |
| 160 | +//删除数据 | |
| 161 | ++ (void)xw_delete:(NSString *)service { | |
| 162 | + NSMutableDictionary *keychainQuery = [self getKeychainQuery:service]; | |
| 163 | + SecItemDelete((CFDictionaryRef)keychainQuery); | |
| 164 | + | |
| 165 | +} | |
| 166 | + | |
| 167 | + | |
| 168 | +//通过 key 获取数据 | |
| 169 | ++ (NSMutableDictionary *)getKeychainQuery:(NSString *)service { | |
| 170 | + return [NSMutableDictionary dictionaryWithObjectsAndKeys: | |
| 171 | + (id)kSecClassGenericPassword,(id)kSecClass, | |
| 172 | + service, (id)kSecAttrService, | |
| 173 | + service, (id)kSecAttrAccount, | |
| 174 | + (id)kSecAttrAccessibleAfterFirstUnlock,(id)kSecAttrAccessible, | |
| 175 | + nil]; | |
| 176 | +} | |
| 177 | + | |
| 178 | ++ (void)xw_deletes{ | |
| 179 | + [NSString xw_delete:KEY_UUID_INSTEAD]; | |
| 180 | + [NSString xw_delete:KEY_TIME_INSTEAD]; | |
| 181 | + | |
| 182 | +} | |
| 183 | + | |
| 184 | +@end | ... | ... |
CNLiveUserSystemSDK.xcodeproj/project.pbxproj
| ... | ... | @@ -33,6 +33,8 @@ |
| 33 | 33 | 8187351D1DA8F60100046D84 /* CNLiveVerificationCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 818735041DA8F60100046D84 /* CNLiveVerificationCode.m */; }; |
| 34 | 34 | 8187351E1DA8F60100046D84 /* NSDictionary+Safety.h in Headers */ = {isa = PBXBuildFile; fileRef = 818735051DA8F60100046D84 /* NSDictionary+Safety.h */; }; |
| 35 | 35 | 8187351F1DA8F60100046D84 /* NSDictionary+Safety.m in Sources */ = {isa = PBXBuildFile; fileRef = 818735061DA8F60100046D84 /* NSDictionary+Safety.m */; }; |
| 36 | + D23A472022D43E7B00A4B465 /* NSString+Keychain.h in Headers */ = {isa = PBXBuildFile; fileRef = D23A471E22D43E7A00A4B465 /* NSString+Keychain.h */; settings = {ATTRIBUTES = (Public, ); }; }; | |
| 37 | + D23A472122D43E7B00A4B465 /* NSString+Keychain.m in Sources */ = {isa = PBXBuildFile; fileRef = D23A471F22D43E7B00A4B465 /* NSString+Keychain.m */; }; | |
| 36 | 38 | D2470C3A1EE65B2800C16A1F /* CNLiveEmailModifyPassword.m in Sources */ = {isa = PBXBuildFile; fileRef = D2470C361EE65B2800C16A1F /* CNLiveEmailModifyPassword.m */; }; |
| 37 | 39 | D2470C3B1EE65B2800C16A1F /* CNLiveEmailModifyPassword.h in Headers */ = {isa = PBXBuildFile; fileRef = D2470C371EE65B2800C16A1F /* CNLiveEmailModifyPassword.h */; }; |
| 38 | 40 | D2470C3C1EE65B2800C16A1F /* CNLiveCheckVerificationCode.m in Sources */ = {isa = PBXBuildFile; fileRef = D2470C381EE65B2800C16A1F /* CNLiveCheckVerificationCode.m */; }; |
| ... | ... | @@ -68,6 +70,8 @@ |
| 68 | 70 | 818735041DA8F60100046D84 /* CNLiveVerificationCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveVerificationCode.m; sourceTree = "<group>"; }; |
| 69 | 71 | 818735051DA8F60100046D84 /* NSDictionary+Safety.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Safety.h"; sourceTree = "<group>"; }; |
| 70 | 72 | 818735061DA8F60100046D84 /* NSDictionary+Safety.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+Safety.m"; sourceTree = "<group>"; }; |
| 73 | + D23A471E22D43E7A00A4B465 /* NSString+Keychain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Keychain.h"; sourceTree = "<group>"; }; | |
| 74 | + D23A471F22D43E7B00A4B465 /* NSString+Keychain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Keychain.m"; sourceTree = "<group>"; }; | |
| 71 | 75 | D2470C361EE65B2800C16A1F /* CNLiveEmailModifyPassword.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveEmailModifyPassword.m; sourceTree = "<group>"; }; |
| 72 | 76 | D2470C371EE65B2800C16A1F /* CNLiveEmailModifyPassword.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveEmailModifyPassword.h; sourceTree = "<group>"; }; |
| 73 | 77 | D2470C381EE65B2800C16A1F /* CNLiveCheckVerificationCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveCheckVerificationCode.m; sourceTree = "<group>"; }; |
| ... | ... | @@ -126,6 +130,8 @@ |
| 126 | 130 | 818734F11DA8F60100046D84 /* CNLiveUserSystemSDK */ = { |
| 127 | 131 | isa = PBXGroup; |
| 128 | 132 | children = ( |
| 133 | + D23A471E22D43E7A00A4B465 /* NSString+Keychain.h */, | |
| 134 | + D23A471F22D43E7B00A4B465 /* NSString+Keychain.m */, | |
| 129 | 135 | 8131D9241DA9E55B00F03C91 /* Common.h */, |
| 130 | 136 | 818734F21DA8F60100046D84 /* CNLiveFeedback.h */, |
| 131 | 137 | 818734F31DA8F60100046D84 /* CNLiveFeedback.m */, |
| ... | ... | @@ -166,6 +172,7 @@ |
| 166 | 172 | files = ( |
| 167 | 173 | D2470C3D1EE65B2800C16A1F /* CNLiveCheckVerificationCode.h in Headers */, |
| 168 | 174 | 8187351B1DA8F60100046D84 /* CNLiveUserSystemTypeDef.h in Headers */, |
| 175 | + D23A472022D43E7B00A4B465 /* NSString+Keychain.h in Headers */, | |
| 169 | 176 | 818735171DA8F60100046D84 /* CNLiveUserSystemCenter.h in Headers */, |
| 170 | 177 | 8187351C1DA8F60100046D84 /* CNLiveVerificationCode.h in Headers */, |
| 171 | 178 | 8187350F1DA8F60100046D84 /* CNLiveRegister.h in Headers */, |
| ... | ... | @@ -225,6 +232,7 @@ |
| 225 | 232 | developmentRegion = English; |
| 226 | 233 | hasScannedForEncodings = 0; |
| 227 | 234 | knownRegions = ( |
| 235 | + English, | |
| 228 | 236 | en, |
| 229 | 237 | ); |
| 230 | 238 | mainGroup = 818734D71DA8F5B900046D84; |
| ... | ... | @@ -278,6 +286,7 @@ |
| 278 | 286 | D2470C3A1EE65B2800C16A1F /* CNLiveEmailModifyPassword.m in Sources */, |
| 279 | 287 | 811A0B101E7BBB3200B56CC9 /* CNLiveUserNetworkManager.m in Sources */, |
| 280 | 288 | 8187350A1DA8F60100046D84 /* CNLiveURLRequestSerialization.m in Sources */, |
| 289 | + D23A472122D43E7B00A4B465 /* NSString+Keychain.m in Sources */, | |
| 281 | 290 | 8187350E1DA8F60100046D84 /* CNLiveLogin.m in Sources */, |
| 282 | 291 | 818735121DA8F60100046D84 /* CNLiveUploadIcon.m in Sources */, |
| 283 | 292 | 8187350C1DA8F60100046D84 /* CNLiveFeedback.m in Sources */, | ... | ... |
Products/CNLiveUserSystemSDK.framework/CNLiveUserSystemSDK deleted
100644 → 0
No preview for this file type
Products/CNLiveUserSystemSDK.framework/Headers/CNLiveUserSystemCenter.h deleted
100644 → 0
| 1 | -// | |
| 2 | -// CNLiveUserSystemCenter.h | |
| 3 | -// CNLiveUserSystemDemo | |
| 4 | -// | |
| 5 | -// Created by iOS on 16/9/12. | |
| 6 | -// Copyright © 2016年 zhulin. All rights reserved. | |
| 7 | -// | |
| 8 | - | |
| 9 | -#import <Foundation/Foundation.h> | |
| 10 | -#import "CNLiveUserSystemTypeDef.h" | |
| 11 | -#import <UIKit/UIKit.h> | |
| 12 | - | |
| 13 | -@interface CNLiveUserSystemCenter : NSObject | |
| 14 | - | |
| 15 | -/** | |
| 16 | - @abstract 初始化 | |
| 17 | - @param appId 注册成功获得应用ID | |
| 18 | - @param appKey 注册成功获得应用key | |
| 19 | - @param appSecret 注册成功获得应用secret | |
| 20 | - @param isTestEnvironment 测试环境开关 | |
| 21 | - @warning 必传参数 | |
| 22 | - 必须在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 方法中调用 | |
| 23 | - */ | |
| 24 | - + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret isTestEnvironment:(BOOL)isTestEnvironment; | |
| 25 | - | |
| 26 | -/** | |
| 27 | - 用户ID | |
| 28 | - | |
| 29 | - @param userId 用户ID | |
| 30 | - */ | |
| 31 | -+ (void)setUserId:(NSString *)userId; | |
| 32 | - | |
| 33 | -/** | |
| 34 | - @abstract 初始化 | |
| 35 | - @param appId 注册成功获得应用ID | |
| 36 | - @param appKey 注册成功获得应用key | |
| 37 | - @param appSecret 注册成功获得应用secret | |
| 38 | - @warning 必传参数 | |
| 39 | - 必须在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 方法中调用 | |
| 40 | - *此方法环境默认为正式环境,建议使用如下方法初始化. | |
| 41 | - + (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret isTestEnvironment:(BOOL)isTestEnvironment; | |
| 42 | - | |
| 43 | - */ | |
| 44 | -+ (void)setAppId:(NSString *)appId appKey:(NSString *)appKey appSecret:(NSString *)appSecret; | |
| 45 | - | |
| 46 | -/** | |
| 47 | - @abstract 注册 | |
| 48 | - @param userName 邮箱或手机 | |
| 49 | - @param password 密码 | |
| 50 | - @param verificationCode 手机验证码(手机号注册时必填) | |
| 51 | - @param invitationCode 邀请码(非必填) | |
| 52 | - @param frmId 渠道ID(非必填) | |
| 53 | - @param success 成功回调 | |
| 54 | - @param failure 失败回调 | |
| 55 | - */ | |
| 56 | -+ (void)registerWithUserName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 57 | - | |
| 58 | - | |
| 59 | -/** | |
| 60 | - @abstract 第三方登录 | |
| 61 | - @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq 3:weixin 4:renren 注:如qq登录,plat=@"2") | |
| 62 | - @param thirdPartyId 第三方用户ID | |
| 63 | - @param nickName 用户昵称 | |
| 64 | - @param gender 性别,m:男、f:女、n:未知(非必填) | |
| 65 | - @param location 用户所在地(非必填) | |
| 66 | - @param faceUrl 头像,约100*100(非必填) | |
| 67 | - @param frmId 渠道ID(非必填) | |
| 68 | - @param success 成功回调 | |
| 69 | - @param failure 失败回调 | |
| 70 | - */ | |
| 71 | -+ (void)thirdPartyLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 72 | - | |
| 73 | - | |
| 74 | -/** | |
| 75 | - @abstract 快捷登录(旧) | |
| 76 | - @param userName 手机号 | |
| 77 | - @param verificationCode 验证码 | |
| 78 | - @param frmId 渠道ID(非必填) | |
| 79 | - @param success 成功回调 | |
| 80 | - @param failure 失败回调 | |
| 81 | - */ | |
| 82 | -+ (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 83 | - | |
| 84 | -/** | |
| 85 | - @abstract 快捷登录(新) | |
| 86 | - @param userName 手机号 | |
| 87 | - @param countryCode 手机号国家码 | |
| 88 | - @param verificationCode 验证码 | |
| 89 | - @param frmId 渠道ID(非必填) | |
| 90 | - @param success 成功回调 | |
| 91 | - @param failure 失败回调 | |
| 92 | - */+ (void)shortcutLoginWithUserName:(NSString *)userName countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id))success failure :(void (^)(NSDictionary *))failure; | |
| 93 | - | |
| 94 | -/** | |
| 95 | - @abstract 登录 | |
| 96 | - @param userName 手机号或邮箱 | |
| 97 | - @param password 密码 | |
| 98 | - @param frmId 渠道ID(非必填) | |
| 99 | - @param success 成功回调 | |
| 100 | - @param failure 失败回调 | |
| 101 | - */ | |
| 102 | -+ (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 103 | - | |
| 104 | - | |
| 105 | -/** | |
| 106 | - @abstract 发送验证码(旧) | |
| 107 | - @param mobile 手机号 | |
| 108 | - @param type 发送验证码类型(详见VerificationCodeType) | |
| 109 | - @param success 成功回调 | |
| 110 | - @param failure 失败回调 | |
| 111 | - */ | |
| 112 | -+ (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 113 | - | |
| 114 | -/** | |
| 115 | - @abstract 发送验证码(新) | |
| 116 | - @param type 发送验证码类型(详见VerificationCodeType) | |
| 117 | - @param mobile 手机号 | |
| 118 | - @param countryCode 手机号国家码 | |
| 119 | - @param success 成功回调 | |
| 120 | - @param failure 失败回调 | |
| 121 | - */ | |
| 122 | -+ (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile countryCode:(NSString *)countryCode success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 123 | - | |
| 124 | - | |
| 125 | -/** | |
| 126 | - @abstract 更新用户附加信息 | |
| 127 | - @param uid 用户ID | |
| 128 | - @param extInfo 扩展信息(格式由对方自己组织,平台只负责存储和原样读取,NSString类型) | |
| 129 | - @param success 成功回调 | |
| 130 | - @param failure 失败回调 | |
| 131 | - */ | |
| 132 | -+ (void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 133 | - | |
| 134 | - | |
| 135 | -/** | |
| 136 | - @abstract 修改用户单项信息 | |
| 137 | - @param type 修改类型(nickName-昵称,gender-性别,email-邮箱, location-联系方式(地址)) | |
| 138 | - @param uid 用户ID | |
| 139 | - @param info 对应的信息(注gender对应f/m/n) | |
| 140 | - @param success 成功回调 | |
| 141 | - @param failure 失败回调 | |
| 142 | - */ | |
| 143 | -+ (void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 144 | - | |
| 145 | - | |
| 146 | -/** | |
| 147 | - @abstract 更新手机号(旧) | |
| 148 | - @param uid 用户ID | |
| 149 | - @param mobile 手机号 | |
| 150 | - @param verificationCode 验证码 | |
| 151 | - @param success 成功回调 | |
| 152 | - @param failure 失败回调 | |
| 153 | - */ | |
| 154 | -+ (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 155 | - | |
| 156 | -/** | |
| 157 | - @abstract 更新手机号(新) | |
| 158 | - @param uid 用户ID | |
| 159 | - @param mobile 手机号 | |
| 160 | - @param countryCode 手机号国家码 | |
| 161 | - @param verificationCode 验证码 | |
| 162 | - @param success 成功回调 | |
| 163 | - @param failure 失败回调 | |
| 164 | - */ | |
| 165 | -+(void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure; | |
| 166 | - | |
| 167 | -/** | |
| 168 | - @abstract 绑定第三方账号 | |
| 169 | - @param uid 用户ID | |
| 170 | - @param plat 第三方平台编号(如platform: 1:sina weibo 2:qq 3:weixin 4:renren 注:如绑定qq,thirdPartyPlat = @"2") | |
| 171 | - @param thirdPartyId 第三方用户ID | |
| 172 | - @param success 成功回调 | |
| 173 | - @param failure 失败回调 | |
| 174 | - */ | |
| 175 | -+ (void)bindingThirdPartyWithUid:(NSString *)uid thirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 176 | - | |
| 177 | - | |
| 178 | -/** | |
| 179 | - @abstract 修改密码(通过手机号修改) | |
| 180 | - @param mobile 手机号 | |
| 181 | - @param verificationCode 验证码 | |
| 182 | - @param newPassword 新密码 | |
| 183 | - @param success 成功回调 | |
| 184 | - @param failure 失败回调 | |
| 185 | - */ | |
| 186 | -+ (void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 187 | - | |
| 188 | - | |
| 189 | -/** | |
| 190 | - @abstract 上传头像 | |
| 191 | - @param uid 用户ID | |
| 192 | - @param icon 头像 (图片质量 0.5) | |
| 193 | - @param success 成功回调 | |
| 194 | - @param failure 失败回调 | |
| 195 | - */ | |
| 196 | -+ (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 197 | - | |
| 198 | -/** | |
| 199 | - @abstract 上传头像 新增 | |
| 200 | - @param uid 用户ID | |
| 201 | - @param compressionQuality 头像质量 0-1 Default 0.5 | |
| 202 | - @param icon 头像 | |
| 203 | - @param success 成功回调 | |
| 204 | - @param failure 失败回调 | |
| 205 | - | |
| 206 | - */ | |
| 207 | -+ (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon compressionQuality:(CGFloat)compressionQuality success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure; | |
| 208 | - | |
| 209 | -/** | |
| 210 | - @abstract 查询用户信息 | |
| 211 | - @param uid 用户ID | |
| 212 | - @param srcUid 被查询用户ID | |
| 213 | - @param success 成功回调 | |
| 214 | - @param failure 失败回调 | |
| 215 | - */ | |
| 216 | -+ (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 217 | - | |
| 218 | - | |
| 219 | -/** | |
| 220 | - @abstract 查询多条用户信息 | |
| 221 | - @param uid 用户ID | |
| 222 | - @param srcUids 被查询用户IDs | |
| 223 | - @param success 成功回调 | |
| 224 | - @param failure 失败回调 | |
| 225 | - */ | |
| 226 | -+ (void)queryMoreUserInfosWithUid:(NSString *)uid srcUids:(NSArray *)srcUids success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 227 | - | |
| 228 | - | |
| 229 | -/** | |
| 230 | - @abstract 用户反馈 | |
| 231 | - @param contentId 举报内容ID | |
| 232 | - @param message 举报内容(app自己组织-不能带特殊字符&号等) | |
| 233 | - @param success 成功回调 | |
| 234 | - @param failure 失败回调 | |
| 235 | - */ | |
| 236 | -+ (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 237 | - | |
| 238 | - | |
| 239 | -/** | |
| 240 | - 通过邮箱修改密码 | |
| 241 | - | |
| 242 | - @param email 邮箱 | |
| 243 | - @param newPwd 新密码 | |
| 244 | - @param success 成功回调 | |
| 245 | - @param failure 失败回调 | |
| 246 | - */ | |
| 247 | -+ (void)modifyPwdWithEmail:(NSString *)email newPwd:(NSString *)newPwd success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | |
| 248 | - | |
| 249 | - | |
| 250 | -/** | |
| 251 | - 通过原密码修改密码 | |
| 252 | - | |
| 253 | - @param uid 用户ID | |
| 254 | - @param pwd 原密码 | |
| 255 | - @param newPwd 新密码 | |
| 256 | - @param success 成功回调 | |
| 257 | - @param failure 失败回调 | |
| 258 | - */ | |
| 259 | -+ (void)oldPwdChangePasswordWithUid:(NSString *)uid pwd:(NSString *)pwd newPwd:(NSString *)newPwd success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | |
| 260 | - | |
| 261 | - | |
| 262 | -/** | |
| 263 | - 注册前校验手机验证码(旧) | |
| 264 | - | |
| 265 | - @param mobile 手机号 | |
| 266 | - @param verificationCode 验证码 | |
| 267 | - @param success 成功回调 | |
| 268 | - @param failure 失败回调 | |
| 269 | - */ | |
| 270 | -+ (void)registerCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | |
| 271 | - | |
| 272 | -/** | |
| 273 | - 注册前校验手机验证码(新) | |
| 274 | - | |
| 275 | - @param mobile 手机号 | |
| 276 | - @param countryCode 手机号国家码 | |
| 277 | - @param verificationCode 验证码 | |
| 278 | - @param success 成功回调 | |
| 279 | - @param failure 失败回调 | |
| 280 | - */ | |
| 281 | -+ (void)registerCheckVerificationCodeWithMobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | |
| 282 | - | |
| 283 | -/** | |
| 284 | - 快捷登录前校验手机验证码(旧) | |
| 285 | - | |
| 286 | - @param mobile 手机号 | |
| 287 | - @param verificationCode 验证码 | |
| 288 | - @param success 成功回调 | |
| 289 | - @param failure 失败回调 | |
| 290 | - */ | |
| 291 | -+ (void)shortcutLoginCheckVerificationCodeWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | |
| 292 | - | |
| 293 | -/** | |
| 294 | - 快捷登录前校验手机验证码(新) | |
| 295 | - | |
| 296 | - @param mobile 手机号 | |
| 297 | - @param countryCode 手机号国家码 | |
| 298 | - @param success 成功回调 | |
| 299 | - @param failure 失败回调 | |
| 300 | - */ | |
| 301 | -+ (void)shortcutLoginCheckVerificationCodeWithMobile:(NSString *)mobile countryCode:(NSString *)countryCode verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | |
| 302 | - | |
| 303 | -/** | |
| 304 | - 验证第三方账号是否注册,若注册则直接登录返回用户信息,若未注册返回errorCode | |
| 305 | - | |
| 306 | - @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq 3:weixin 4:renren 注:如qq登录,plat=@"2") | |
| 307 | - @param thirdPartyId 第三方用户ID | |
| 308 | - @param frmId 渠道ID(非必填) | |
| 309 | - @param success 成功回调 | |
| 310 | - @param failure 失败回调 | |
| 311 | - */ | |
| 312 | -+ (void)thirdPartyCheckLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; | |
| 313 | - | |
| 314 | - | |
| 315 | -/** | |
| 316 | - 第三方注册强制绑定手机号登录: 手机号+密码+验证码+三方账号 | |
| 317 | - | |
| 318 | - @param plat 第三方平台编号(如plat: 1:sina weibo 2:qq 3:weixin 4:renren 注:如qq登录,plat=@"2") | |
| 319 | - @param thirdPartyId 第三方用户ID | |
| 320 | - @param nickName 用户昵称 | |
| 321 | - @param gender 性别,m:男、f:女、n:未知(非必填) | |
| 322 | - @param location 用户所在地(非必填) | |
| 323 | - @param faceUrl 头像,约100*100(非必填) | |
| 324 | - @param mobile 手机号 | |
| 325 | - @param verificationCode 验证码 (验证码类型为快捷登录VerificationCodeTypeShortcutLogin) | |
| 326 | - @param pawd 注册密码 | |
| 327 | - @param frmId 渠道ID(非必填) | |
| 328 | - @param success 成功回调 | |
| 329 | - @param failure 失败回调 | |
| 330 | - */ | |
| 331 | -+ (void)thirdPartyBindMobileLoginWithThirdPartyPlatType:(NSString *)plat thirdPartyId:(NSString *)thirdPartyId nickName:(NSString *)nickName gender:(NSString *)gender location:(NSString *)location faceUrl:(NSString *)faceUrl mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode pawd:(NSString *)pawd frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; | |
| 332 | - | |
| 333 | - | |
| 334 | -/** | |
| 335 | - * 获取SDK版本号 v2.1.0 | |
| 336 | - */ | |
| 337 | -+ (NSString *)getVersion; | |
| 338 | - | |
| 339 | - | |
| 340 | - | |
| 341 | -@end |
Products/CNLiveUserSystemSDK.framework/Headers/CNLiveUserSystemTypeDef.h deleted
100644 → 0
| 1 | -// | |
| 2 | -// CNLiveUserSystemTypeDef.h | |
| 3 | -// CNLiveUserSystemDemo | |
| 4 | -// | |
| 5 | -// Created by iOS on 16/9/12. | |
| 6 | -// Copyright © 2016年 zhulin. All rights reserved. | |
| 7 | -// | |
| 8 | - | |
| 9 | -#ifndef CNLiveUserSystemTypeDef_h | |
| 10 | -#define CNLiveUserSystemTypeDef_h | |
| 11 | - | |
| 12 | -//获取验证码 | |
| 13 | -typedef NS_ENUM(NSUInteger, VerificationCodeType) { | |
| 14 | - VerificationCodeTypeShortcutLogin = 0, //快捷登录 | |
| 15 | - VerificationCodeTypeRegister, //注册或修改手机号 | |
| 16 | - VerificationCodeTypeRetrievePassword //找回或修改密码 | |
| 17 | -}; | |
| 18 | - | |
| 19 | -//修改单项用户信息类型 | |
| 20 | -typedef NS_ENUM(NSUInteger, UserInfoType) { | |
| 21 | - UserInfoTypeNickName = 0, //昵称 | |
| 22 | - UserInfoTypeGender, //性别(f/m/n) | |
| 23 | - UserInfoTypeEmail, //邮箱 | |
| 24 | - UserInfoTypeLocation, //联系方式(地址) | |
| 25 | -}; | |
| 26 | - | |
| 27 | -//校验验证码 | |
| 28 | -typedef NS_ENUM(NSInteger, CheckVerificationCodeType) { | |
| 29 | - CheckVerificationCodeTypeRegister = 0,//注册前校验验证码 | |
| 30 | - CheckVerificationCodeTypeShortcutLogin //快捷登录前校验验证码 | |
| 31 | -}; | |
| 32 | - | |
| 33 | -#endif /* CNLiveUserSystemTypeDef_h */ |
Products/CNLiveUserSystemSDK.framework/Info.plist deleted
100644 → 0
No preview for this file type