Commit 9c21139637078532037e207447c37d2d3f5b8eb7
1 parent
cb1a8bd8
修改failure返回数据格式
Showing
29 changed files
with
253 additions
and
140 deletions
CNLiveUserSystemDemo.xcodeproj/project.xcworkspace/xcuserdata/iOS.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
CNLiveUserSystemDemo.xcodeproj/xcuserdata/iOS.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
| @@ -13,5 +13,69 @@ | @@ -13,5 +13,69 @@ | ||
| 13 | stopOnStyle = "0"> | 13 | stopOnStyle = "0"> |
| 14 | </BreakpointContent> | 14 | </BreakpointContent> |
| 15 | </BreakpointProxy> | 15 | </BreakpointProxy> |
| 16 | + <BreakpointProxy | ||
| 17 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
| 18 | + <BreakpointContent | ||
| 19 | + shouldBeEnabled = "Yes" | ||
| 20 | + ignoreCount = "0" | ||
| 21 | + continueAfterRunningActions = "No" | ||
| 22 | + filePath = "CNLiveUserSystemDemo/Conreollers/RegisterViewController.m" | ||
| 23 | + timestampString = "501061773.344801" | ||
| 24 | + startingColumnNumber = "9223372036854775807" | ||
| 25 | + endingColumnNumber = "9223372036854775807" | ||
| 26 | + startingLineNumber = "60" | ||
| 27 | + endingLineNumber = "60" | ||
| 28 | + landmarkName = "-verificationBtnAction" | ||
| 29 | + landmarkType = "7"> | ||
| 30 | + </BreakpointContent> | ||
| 31 | + </BreakpointProxy> | ||
| 32 | + <BreakpointProxy | ||
| 33 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
| 34 | + <BreakpointContent | ||
| 35 | + shouldBeEnabled = "Yes" | ||
| 36 | + ignoreCount = "0" | ||
| 37 | + continueAfterRunningActions = "No" | ||
| 38 | + filePath = "CNLiveUserSystemDemo/Conreollers/RegisterViewController.m" | ||
| 39 | + timestampString = "501061776.857064" | ||
| 40 | + startingColumnNumber = "9223372036854775807" | ||
| 41 | + endingColumnNumber = "9223372036854775807" | ||
| 42 | + startingLineNumber = "63" | ||
| 43 | + endingLineNumber = "63" | ||
| 44 | + landmarkName = "-verificationBtnAction" | ||
| 45 | + landmarkType = "7"> | ||
| 46 | + </BreakpointContent> | ||
| 47 | + </BreakpointProxy> | ||
| 48 | + <BreakpointProxy | ||
| 49 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
| 50 | + <BreakpointContent | ||
| 51 | + shouldBeEnabled = "Yes" | ||
| 52 | + ignoreCount = "0" | ||
| 53 | + continueAfterRunningActions = "No" | ||
| 54 | + filePath = "CNLiveUserSystemDemo/Conreollers/ModifyUserInfoViewController.m" | ||
| 55 | + timestampString = "501062337.466231" | ||
| 56 | + startingColumnNumber = "9223372036854775807" | ||
| 57 | + endingColumnNumber = "9223372036854775807" | ||
| 58 | + startingLineNumber = "63" | ||
| 59 | + endingLineNumber = "63" | ||
| 60 | + landmarkName = "-saveBtnAction" | ||
| 61 | + landmarkType = "7"> | ||
| 62 | + </BreakpointContent> | ||
| 63 | + </BreakpointProxy> | ||
| 64 | + <BreakpointProxy | ||
| 65 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
| 66 | + <BreakpointContent | ||
| 67 | + shouldBeEnabled = "Yes" | ||
| 68 | + ignoreCount = "0" | ||
| 69 | + continueAfterRunningActions = "No" | ||
| 70 | + filePath = "CNLiveUserSystemDemo/Conreollers/ModifyUserInfoViewController.m" | ||
| 71 | + timestampString = "501062339.330438" | ||
| 72 | + startingColumnNumber = "9223372036854775807" | ||
| 73 | + endingColumnNumber = "9223372036854775807" | ||
| 74 | + startingLineNumber = "67" | ||
| 75 | + endingLineNumber = "67" | ||
| 76 | + landmarkName = "-saveBtnAction" | ||
| 77 | + landmarkType = "7"> | ||
| 78 | + </BreakpointContent> | ||
| 79 | + </BreakpointProxy> | ||
| 16 | </Breakpoints> | 80 | </Breakpoints> |
| 17 | </Bucket> | 81 | </Bucket> |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveFeedback.h
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | 10 | ||
| 11 | @interface CNLiveFeedback : NSObject | 11 | @interface CNLiveFeedback : NSObject |
| 12 | 12 | ||
| 13 | -- (void)feedbackWithAppId:(NSString *)appId appKey:(NSString *)appKey contentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 13 | +- (void)feedbackWithAppId:(NSString *)appId appKey:(NSString *)appKey contentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | @end | 16 | @end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveFeedback.m
| @@ -16,7 +16,7 @@ static NSString *feedbackURL = @"https://api.cnlive.com/open/api2/user/userRepo | @@ -16,7 +16,7 @@ static NSString *feedbackURL = @"https://api.cnlive.com/open/api2/user/userRepo | ||
| 16 | 16 | ||
| 17 | @implementation CNLiveFeedback | 17 | @implementation CNLiveFeedback |
| 18 | 18 | ||
| 19 | -- (void)feedbackWithAppId:(NSString *)appId appKey:(NSString *)appKey contentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure:(void (^)(NSError *))failure | 19 | +- (void)feedbackWithAppId:(NSString *)appId appKey:(NSString *)appKey contentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| 20 | { | 20 | { |
| 21 | 21 | ||
| 22 | NSDate *date = [NSDate date]; | 22 | NSDate *date = [NSDate date]; |
| @@ -41,7 +41,7 @@ static NSString *feedbackURL = @"https://api.cnlive.com/open/api2/user/userRepo | @@ -41,7 +41,7 @@ static NSString *feedbackURL = @"https://api.cnlive.com/open/api2/user/userRepo | ||
| 41 | 41 | ||
| 42 | #pragma mark - request | 42 | #pragma mark - request |
| 43 | 43 | ||
| 44 | -- (void)requestWithParameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSError * error))failure | 44 | +- (void)requestWithParameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
| 45 | { | 45 | { |
| 46 | [[CNLiveNetworkManager manager] requestPostURL:feedbackURL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { | 46 | [[CNLiveNetworkManager manager] requestPostURL:feedbackURL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { |
| 47 | 47 | ||
| @@ -49,19 +49,27 @@ static NSString *feedbackURL = @"https://api.cnlive.com/open/api2/user/userRepo | @@ -49,19 +49,27 @@ static NSString *feedbackURL = @"https://api.cnlive.com/open/api2/user/userRepo | ||
| 49 | 49 | ||
| 50 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | 50 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { |
| 51 | 51 | ||
| 52 | - success(responseObject); | 52 | + if (success) { |
| 53 | + success(responseObject); | ||
| 54 | + } | ||
| 53 | 55 | ||
| 54 | } else { | 56 | } else { |
| 55 | 57 | ||
| 56 | - NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:[responseObject[@"errorCode"] integerValue] userInfo:@{NSLocalizedDescriptionKey : responseObject[@"errorMessage"]}]; | ||
| 57 | - failure(error); | 58 | + if (failure) { |
| 59 | + failure(responseObject); | ||
| 60 | + } | ||
| 58 | 61 | ||
| 59 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; | 62 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; |
| 60 | } | 63 | } |
| 61 | 64 | ||
| 62 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { | 65 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { |
| 63 | 66 | ||
| 64 | - failure(error); | 67 | + NSDictionary *errorDic = @{@"errorCode": [NSString stringWithFormat:@"%ld", error.code], @"errorMessage": error.localizedDescription}; |
| 68 | + | ||
| 69 | + if (failure) { | ||
| 70 | + failure(errorDic); | ||
| 71 | + } | ||
| 72 | + | ||
| 65 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; | 73 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; |
| 66 | 74 | ||
| 67 | }]; | 75 | }]; |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveLogin.h
| @@ -13,16 +13,16 @@ | @@ -13,16 +13,16 @@ | ||
| 13 | /** | 13 | /** |
| 14 | * 第三方登录 | 14 | * 第三方登录 |
| 15 | */ | 15 | */ |
| 16 | -- (void)thirdPartyLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(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 (^)(NSError *error))failure; | 16 | +- (void)thirdPartyLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(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; |
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | * 快捷登录 | 19 | * 快捷登录 |
| 20 | */ | 20 | */ |
| 21 | -- (void)shortcutLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 21 | +- (void)shortcutLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 22 | 22 | ||
| 23 | /** | 23 | /** |
| 24 | * 登录 | 24 | * 登录 |
| 25 | */ | 25 | */ |
| 26 | -- (void)loginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 26 | +- (void)loginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 27 | 27 | ||
| 28 | @end | 28 | @end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveLogin.m
| @@ -22,7 +22,7 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | @@ -22,7 +22,7 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | ||
| 22 | 22 | ||
| 23 | @implementation CNLiveLogin | 23 | @implementation CNLiveLogin |
| 24 | 24 | ||
| 25 | -- (void)thirdPartyLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(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 (^)(NSError *))failure | 25 | +- (void)thirdPartyLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey thirdPartyPlatType:(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 *))failure |
| 26 | { | 26 | { |
| 27 | NSDate *date = [NSDate date]; | 27 | NSDate *date = [NSDate date]; |
| 28 | NSInteger time = [date timeIntervalSince1970]; | 28 | NSInteger time = [date timeIntervalSince1970]; |
| @@ -53,7 +53,7 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | @@ -53,7 +53,7 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | ||
| 53 | /** | 53 | /** |
| 54 | * 快捷登录 | 54 | * 快捷登录 |
| 55 | */ | 55 | */ |
| 56 | -- (void)shortcutLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure | 56 | +- (void)shortcutLoginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
| 57 | { | 57 | { |
| 58 | NSDate *date = [NSDate date]; | 58 | NSDate *date = [NSDate date]; |
| 59 | NSInteger time = [date timeIntervalSince1970]; | 59 | NSInteger time = [date timeIntervalSince1970]; |
| @@ -80,7 +80,7 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | @@ -80,7 +80,7 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | ||
| 80 | /** | 80 | /** |
| 81 | * 登录 | 81 | * 登录 |
| 82 | */ | 82 | */ |
| 83 | -- (void)loginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSError *))failure | 83 | +- (void)loginWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure |
| 84 | { | 84 | { |
| 85 | NSDate *date = [NSDate date]; | 85 | NSDate *date = [NSDate date]; |
| 86 | NSInteger time = [date timeIntervalSince1970]; | 86 | NSInteger time = [date timeIntervalSince1970]; |
| @@ -105,7 +105,7 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | @@ -105,7 +105,7 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | ||
| 105 | 105 | ||
| 106 | #pragma mark - request | 106 | #pragma mark - request |
| 107 | 107 | ||
| 108 | -- (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSError * error))failure | 108 | +- (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
| 109 | { | 109 | { |
| 110 | [[CNLiveNetworkManager manager] requestPostURL:URL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { | 110 | [[CNLiveNetworkManager manager] requestPostURL:URL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { |
| 111 | 111 | ||
| @@ -113,24 +113,31 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | @@ -113,24 +113,31 @@ static NSString *thirdLoginURL = @"https://api.cnlive.com/open/api2/user/loginI | ||
| 113 | 113 | ||
| 114 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | 114 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { |
| 115 | 115 | ||
| 116 | - success(responseObject); | ||
| 117 | - | ||
| 118 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; | 116 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; |
| 119 | [userDefaults setObject:responseObject[@"data"][@"token"] forKey:@"CNLiveAuthToken"]; | 117 | [userDefaults setObject:responseObject[@"data"][@"token"] forKey:@"CNLiveAuthToken"]; |
| 120 | [userDefaults setObject:responseObject[@"data"][@"uid"] forKey:@"CNLiveUserSid"]; | 118 | [userDefaults setObject:responseObject[@"data"][@"uid"] forKey:@"CNLiveUserSid"]; |
| 121 | [userDefaults synchronize]; | 119 | [userDefaults synchronize]; |
| 120 | + | ||
| 121 | + if (success) { | ||
| 122 | + success(responseObject); | ||
| 123 | + } | ||
| 122 | 124 | ||
| 123 | } else { | 125 | } else { |
| 124 | 126 | ||
| 125 | - NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:[responseObject[@"errorCode"] integerValue] userInfo:@{NSLocalizedDescriptionKey : responseObject[@"errorMessage"]}]; | ||
| 126 | - failure(error); | 127 | + if (failure) { |
| 128 | + failure(responseObject); | ||
| 129 | + } | ||
| 127 | 130 | ||
| 128 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; | 131 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; |
| 129 | } | 132 | } |
| 130 | 133 | ||
| 131 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { | 134 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { |
| 132 | 135 | ||
| 133 | - failure(error); | 136 | + NSDictionary *errorDic = @{@"errorCode": [NSString stringWithFormat:@"%ld", error.code], @"errorMessage": error.localizedDescription}; |
| 137 | + | ||
| 138 | + if (failure) { | ||
| 139 | + failure(errorDic); | ||
| 140 | + } | ||
| 134 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; | 141 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; |
| 135 | 142 | ||
| 136 | }]; | 143 | }]; |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveRegister.h
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | 10 | ||
| 11 | @interface CNLiveRegister : NSObject | 11 | @interface CNLiveRegister : NSObject |
| 12 | 12 | ||
| 13 | -- (void)registerWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 13 | +- (void)registerWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | @end | 16 | @end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveRegister.m
| @@ -16,7 +16,7 @@ static NSString *registerURL = @"https://api.cnlive.com/open/api2/user/register | @@ -16,7 +16,7 @@ static NSString *registerURL = @"https://api.cnlive.com/open/api2/user/register | ||
| 16 | 16 | ||
| 17 | @implementation CNLiveRegister | 17 | @implementation CNLiveRegister |
| 18 | 18 | ||
| 19 | -- (void)registerWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSError *))failure | 19 | +- (void)registerWithAppId:(NSString *)appId appKey:(NSString *)appKey userName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure |
| 20 | { | 20 | { |
| 21 | 21 | ||
| 22 | NSDate *date = [NSDate date]; | 22 | NSDate *date = [NSDate date]; |
| @@ -44,7 +44,7 @@ static NSString *registerURL = @"https://api.cnlive.com/open/api2/user/register | @@ -44,7 +44,7 @@ static NSString *registerURL = @"https://api.cnlive.com/open/api2/user/register | ||
| 44 | 44 | ||
| 45 | #pragma mark - request | 45 | #pragma mark - request |
| 46 | 46 | ||
| 47 | -- (void)requestWithParameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSError * error))failure | 47 | +- (void)requestWithParameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
| 48 | { | 48 | { |
| 49 | 49 | ||
| 50 | [[CNLiveNetworkManager manager] requestPostURL:registerURL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { | 50 | [[CNLiveNetworkManager manager] requestPostURL:registerURL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { |
| @@ -53,25 +53,33 @@ static NSString *registerURL = @"https://api.cnlive.com/open/api2/user/register | @@ -53,25 +53,33 @@ static NSString *registerURL = @"https://api.cnlive.com/open/api2/user/register | ||
| 53 | 53 | ||
| 54 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | 54 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { |
| 55 | 55 | ||
| 56 | - success(responseObject); | ||
| 57 | - | ||
| 58 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; | 56 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; |
| 59 | [userDefaults setObject:responseObject[@"data"][@"token"] forKey:@"CNLiveAuthToken"]; | 57 | [userDefaults setObject:responseObject[@"data"][@"token"] forKey:@"CNLiveAuthToken"]; |
| 60 | [userDefaults setObject:responseObject[@"data"][@"uid"] forKey:@"CNLiveUserSid"]; | 58 | [userDefaults setObject:responseObject[@"data"][@"uid"] forKey:@"CNLiveUserSid"]; |
| 61 | - | ||
| 62 | [userDefaults synchronize]; | 59 | [userDefaults synchronize]; |
| 63 | 60 | ||
| 61 | + if (success) { | ||
| 62 | + success(responseObject); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + | ||
| 64 | } else { | 66 | } else { |
| 65 | 67 | ||
| 66 | - NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:[responseObject[@"errorCode"] integerValue] userInfo:@{NSLocalizedDescriptionKey : responseObject[@"errorMessage"]}]; | ||
| 67 | - failure(error); | 68 | + if (failure) { |
| 69 | + failure(responseObject); | ||
| 70 | + } | ||
| 68 | 71 | ||
| 69 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; | 72 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; |
| 70 | } | 73 | } |
| 71 | 74 | ||
| 72 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { | 75 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { |
| 73 | 76 | ||
| 74 | - failure(error); | 77 | + NSDictionary *errorDic = @{@"errorCode": [NSString stringWithFormat:@"%ld", error.code], @"errorMessage": error.localizedDescription}; |
| 78 | + | ||
| 79 | + if (failure) { | ||
| 80 | + failure(errorDic); | ||
| 81 | + } | ||
| 82 | + | ||
| 75 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; | 83 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; |
| 76 | 84 | ||
| 77 | }]; | 85 | }]; |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUploadIcon.h
| @@ -11,6 +11,6 @@ | @@ -11,6 +11,6 @@ | ||
| 11 | 11 | ||
| 12 | @interface CNLiveUploadIcon : NSObject | 12 | @interface CNLiveUploadIcon : NSObject |
| 13 | 13 | ||
| 14 | -- (void)uploadIconWithAppId:(NSString *)appId uid:(NSString *)uid icon:(UIImage *)image token:(NSString *)token secret:(NSString *)secret success:(void (^)(id))success failure:(void (^)(NSError *))failure; | 14 | +- (void)uploadIconWithAppId:(NSString *)appId uid:(NSString *)uid icon:(UIImage *)image token:(NSString *)token secret:(NSString *)secret success:(void (^)(id))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 15 | 15 | ||
| 16 | @end | 16 | @end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUploadIcon.m
| @@ -19,14 +19,14 @@ static NSString *uploadIconURL = @"https://api.cnlive.com/open/api2/user/update | @@ -19,14 +19,14 @@ static NSString *uploadIconURL = @"https://api.cnlive.com/open/api2/user/update | ||
| 19 | 19 | ||
| 20 | @implementation CNLiveUploadIcon | 20 | @implementation CNLiveUploadIcon |
| 21 | 21 | ||
| 22 | -- (void)uploadIconWithAppId:(NSString *)appId uid:(NSString *)uid icon:(UIImage *)image token:(NSString *)token secret:(NSString *)secret success:(void (^)(id))success failure:(void (^)(NSError *))failure | 22 | +- (void)uploadIconWithAppId:(NSString *)appId uid:(NSString *)uid icon:(UIImage *)image token:(NSString *)token secret:(NSString *)secret success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| 23 | { | 23 | { |
| 24 | [self getAccessTokenRequestWithAppId:appId uid:uid icon:image token:token secret:secret success:success failure:failure]; | 24 | [self getAccessTokenRequestWithAppId:appId uid:uid icon:image token:token secret:secret success:success failure:failure]; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | #pragma mark - request | 27 | #pragma mark - request |
| 28 | 28 | ||
| 29 | -- (void)getAccessTokenRequestWithAppId:(NSString *)appId uid:(NSString *)uid icon:(UIImage *)image token:(NSString *)token secret:(NSString *)secret success:(void (^)(id))success failure:(void (^)(NSError *))failure | 29 | +- (void)getAccessTokenRequestWithAppId:(NSString *)appId uid:(NSString *)uid icon:(UIImage *)image token:(NSString *)token secret:(NSString *)secret success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| 30 | { | 30 | { |
| 31 | NSDictionary *paramters = @{@"appId":[CNLiveUserSystemTools verify:appId], | 31 | NSDictionary *paramters = @{@"appId":[CNLiveUserSystemTools verify:appId], |
| 32 | @"secret":[CNLiveUserSystemTools verify:secret]}; | 32 | @"secret":[CNLiveUserSystemTools verify:secret]}; |
| @@ -41,20 +41,30 @@ static NSString *uploadIconURL = @"https://api.cnlive.com/open/api2/user/update | @@ -41,20 +41,30 @@ static NSString *uploadIconURL = @"https://api.cnlive.com/open/api2/user/update | ||
| 41 | NSDictionary *dic = responseObject[@"data"]; | 41 | NSDictionary *dic = responseObject[@"data"]; |
| 42 | [self uploadIconRequestWithUid:uid icon:image token:token access_token:dic[@"access_token"] success:success failure:failure]; | 42 | [self uploadIconRequestWithUid:uid icon:image token:token access_token:dic[@"access_token"] success:success failure:failure]; |
| 43 | } else { | 43 | } else { |
| 44 | - NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey :responseObject[@"errorMessage"]}]; | ||
| 45 | - failure(error); | 44 | + if (failure) { |
| 45 | + failure(responseObject); | ||
| 46 | + } | ||
| 46 | } | 47 | } |
| 47 | } else { | 48 | } else { |
| 48 | - NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey :@"获取access_token失败"}]; | ||
| 49 | - failure(error); | 49 | + NSDictionary *errorDic = @{@"errorCode": @"-1", |
| 50 | + @"errorMessage": @"获取access_token失败"}; | ||
| 51 | + | ||
| 52 | + if (failure) { | ||
| 53 | + failure(errorDic); | ||
| 54 | + } | ||
| 50 | } | 55 | } |
| 51 | 56 | ||
| 52 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { | 57 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { |
| 53 | - failure(error); | 58 | + |
| 59 | + NSDictionary *errorDic = @{@"errorCode": [NSString stringWithFormat:@"%ld", error.code], @"errorMessage": error.localizedDescription}; | ||
| 60 | + | ||
| 61 | + if (failure) { | ||
| 62 | + failure(errorDic); | ||
| 63 | + } | ||
| 54 | }]; | 64 | }]; |
| 55 | } | 65 | } |
| 56 | 66 | ||
| 57 | -- (void)uploadIconRequestWithUid:(NSString *)uid icon:(UIImage *)image token:(NSString *)token access_token:(NSString *)accessToken success:(void (^)(id))success failure:(void (^)(NSError *))failure | 67 | +- (void)uploadIconRequestWithUid:(NSString *)uid icon:(UIImage *)image token:(NSString *)token access_token:(NSString *)accessToken success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| 58 | { | 68 | { |
| 59 | NSData *data = UIImageJPEGRepresentation(image, 0.5); | 69 | NSData *data = UIImageJPEGRepresentation(image, 0.5); |
| 60 | 70 | ||
| @@ -69,19 +79,28 @@ static NSString *uploadIconURL = @"https://api.cnlive.com/open/api2/user/update | @@ -69,19 +79,28 @@ static NSString *uploadIconURL = @"https://api.cnlive.com/open/api2/user/update | ||
| 69 | 79 | ||
| 70 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | 80 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { |
| 71 | 81 | ||
| 72 | - success(responseObject); | 82 | + if (success) { |
| 83 | + success(responseObject); | ||
| 84 | + } | ||
| 73 | 85 | ||
| 74 | } else { | 86 | } else { |
| 75 | 87 | ||
| 76 | - NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:[responseObject[@"errorCode"] integerValue] userInfo:@{NSLocalizedDescriptionKey : responseObject[@"errorMessage"]}]; | ||
| 77 | - failure(error); | 88 | + if (failure) { |
| 89 | + failure(responseObject); | ||
| 90 | + } | ||
| 78 | 91 | ||
| 79 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; | 92 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; |
| 80 | } | 93 | } |
| 81 | 94 | ||
| 82 | 95 | ||
| 83 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { | 96 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { |
| 84 | - failure(error); | 97 | + |
| 98 | + NSDictionary *errorDic = @{@"errorCode": [NSString stringWithFormat:@"%ld", error.code], @"errorMessage": error.localizedDescription}; | ||
| 99 | + | ||
| 100 | + if (failure) { | ||
| 101 | + failure(errorDic); | ||
| 102 | + } | ||
| 103 | + | ||
| 85 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; | 104 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; |
| 86 | }]; | 105 | }]; |
| 87 | } | 106 | } |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserInfo.h
| @@ -14,22 +14,22 @@ | @@ -14,22 +14,22 @@ | ||
| 14 | /** | 14 | /** |
| 15 | * 更新手机号 | 15 | * 更新手机号 |
| 16 | */ | 16 | */ |
| 17 | -- (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 17 | +- (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | * 查询用户信息 | 20 | * 查询用户信息 |
| 21 | */ | 21 | */ |
| 22 | -- (void)queryUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid srcUid:(NSString *)srcUid token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 22 | +- (void)queryUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid srcUid:(NSString *)srcUid token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * 修改用户单项信息 | 25 | * 修改用户单项信息 |
| 26 | */ | 26 | */ |
| 27 | -- (void)modifyUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 27 | +- (void)modifyUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 28 | 28 | ||
| 29 | -- (void)updateOtherInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid extInfo:(NSString *)extInfo token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 29 | +- (void)updateOtherInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid extInfo:(NSString *)extInfo token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 30 | /** | 30 | /** |
| 31 | * 通过手机修改密码 | 31 | * 通过手机修改密码 |
| 32 | */ | 32 | */ |
| 33 | -- (void)changePasswordWithAppId:(NSString *)appId appKey:(NSString *)appKey mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 33 | +- (void)changePasswordWithAppId:(NSString *)appId appKey:(NSString *)appKey mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 34 | 34 | ||
| 35 | @end | 35 | @end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserInfo.m
| @@ -31,7 +31,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | @@ -31,7 +31,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | ||
| 31 | /** | 31 | /** |
| 32 | * 更新手机号 | 32 | * 更新手机号 |
| 33 | */ | 33 | */ |
| 34 | -- (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSError *))failure | 34 | +- (void)updateMobileWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure |
| 35 | { | 35 | { |
| 36 | NSDate *date = [NSDate date]; | 36 | NSDate *date = [NSDate date]; |
| 37 | NSInteger time = [date timeIntervalSince1970]; | 37 | NSInteger time = [date timeIntervalSince1970]; |
| @@ -58,7 +58,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | @@ -58,7 +58,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | ||
| 58 | /** | 58 | /** |
| 59 | * 查询用户信息 | 59 | * 查询用户信息 |
| 60 | */ | 60 | */ |
| 61 | -- (void)queryUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid srcUid:(NSString *)srcUid token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSError *))failure | 61 | +- (void)queryUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid srcUid:(NSString *)srcUid token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure |
| 62 | { | 62 | { |
| 63 | NSDate *date = [NSDate date]; | 63 | NSDate *date = [NSDate date]; |
| 64 | NSInteger time = [date timeIntervalSince1970]; | 64 | NSInteger time = [date timeIntervalSince1970]; |
| @@ -72,6 +72,8 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | @@ -72,6 +72,8 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | ||
| 72 | @"platform_id":[NSBundle mainBundle].bundleIdentifier, | 72 | @"platform_id":[NSBundle mainBundle].bundleIdentifier, |
| 73 | @"timestamp": timeString}; | 73 | @"timestamp": timeString}; |
| 74 | 74 | ||
| 75 | + NSLog(@"查询参数-----------%@",params); | ||
| 76 | + | ||
| 75 | NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; | 77 | NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:params]; |
| 76 | NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; | 78 | NSString *string = [NSString stringWithFormat:@"%@&key=%@", [CNLiveUserSystemTools signvalue:parameter], [CNLiveUserSystemTools verify:appKey]]; |
| 77 | NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; | 79 | NSString *signString = [[CNLiveUserSystemTools sha1:string] uppercaseString]; |
| @@ -84,7 +86,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | @@ -84,7 +86,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | ||
| 84 | /** | 86 | /** |
| 85 | * 修改用户单项信息 | 87 | * 修改用户单项信息 |
| 86 | */ | 88 | */ |
| 87 | -- (void)modifyUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSError *error))failure | 89 | +- (void)modifyUserInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info token:(NSString *)token success:(void (^)(id result))success failure :(void (^)(NSDictionary *error))failure |
| 88 | { | 90 | { |
| 89 | 91 | ||
| 90 | NSDate *date = [NSDate date]; | 92 | NSDate *date = [NSDate date]; |
| @@ -112,7 +114,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | @@ -112,7 +114,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | ||
| 112 | /** | 114 | /** |
| 113 | * 更新用户附加信息 | 115 | * 更新用户附加信息 |
| 114 | */ | 116 | */ |
| 115 | -- (void)updateOtherInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid extInfo:(NSString *)extInfo token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSError *))failure | 117 | +- (void)updateOtherInfoWithAppId:(NSString *)appId appKey:(NSString *)appKey uid:(NSString *)uid extInfo:(NSString *)extInfo token:(NSString *)token success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure |
| 116 | { | 118 | { |
| 117 | NSDate *date = [NSDate date]; | 119 | NSDate *date = [NSDate date]; |
| 118 | NSInteger time = [date timeIntervalSince1970]; | 120 | NSInteger time = [date timeIntervalSince1970]; |
| @@ -137,7 +139,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | @@ -137,7 +139,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | ||
| 137 | /** | 139 | /** |
| 138 | * 修改密码 | 140 | * 修改密码 |
| 139 | */ | 141 | */ |
| 140 | -- (void)changePasswordWithAppId:(NSString *)appId appKey:(NSString *)appKey mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure:(void (^)(NSError *))failure | 142 | +- (void)changePasswordWithAppId:(NSString *)appId appKey:(NSString *)appKey mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure |
| 141 | { | 143 | { |
| 142 | NSDate *date = [NSDate date]; | 144 | NSDate *date = [NSDate date]; |
| 143 | NSInteger time = [date timeIntervalSince1970]; | 145 | NSInteger time = [date timeIntervalSince1970]; |
| @@ -162,7 +164,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | @@ -162,7 +164,7 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | ||
| 162 | 164 | ||
| 163 | #pragma mark - request | 165 | #pragma mark - request |
| 164 | 166 | ||
| 165 | -- (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSError * error))failure | 167 | +- (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
| 166 | { | 168 | { |
| 167 | 169 | ||
| 168 | [[CNLiveNetworkManager manager] requestPostURL:URL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { | 170 | [[CNLiveNetworkManager manager] requestPostURL:URL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { |
| @@ -171,19 +173,27 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | @@ -171,19 +173,27 @@ static NSString *updatePwdURL = @"https://api.cnlive.com/open/api2/user/updateP | ||
| 171 | 173 | ||
| 172 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | 174 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { |
| 173 | 175 | ||
| 174 | - success(responseObject); | 176 | + if (success) { |
| 177 | + success(responseObject); | ||
| 178 | + } | ||
| 175 | 179 | ||
| 176 | } else { | 180 | } else { |
| 177 | 181 | ||
| 178 | - NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:[responseObject[@"errorCode"] integerValue] userInfo:@{NSLocalizedDescriptionKey : responseObject[@"errorMessage"]}]; | ||
| 179 | - failure(error); | 182 | + if (failure) { |
| 183 | + failure(responseObject); | ||
| 184 | + } | ||
| 180 | 185 | ||
| 181 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; | 186 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; |
| 182 | } | 187 | } |
| 183 | 188 | ||
| 184 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { | 189 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { |
| 185 | 190 | ||
| 186 | - failure(error); | 191 | + NSDictionary *errorDic = @{@"errorCode": [NSString stringWithFormat:@"%ld", error.code], @"errorMessage": error.localizedDescription}; |
| 192 | + | ||
| 193 | + if (failure) { | ||
| 194 | + failure(errorDic); | ||
| 195 | + } | ||
| 196 | + | ||
| 187 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; | 197 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; |
| 188 | 198 | ||
| 189 | }]; | 199 | }]; |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.h
| @@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
| 32 | @param success 成功回调 | 32 | @param success 成功回调 |
| 33 | @param failure 失败回调 | 33 | @param failure 失败回调 |
| 34 | */ | 34 | */ |
| 35 | -+ (void)registerWithUserName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 35 | ++ (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; |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| 38 | @abstract 第三方登录 | 38 | @abstract 第三方登录 |
| @@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
| 46 | @param success 成功回调 | 46 | @param success 成功回调 |
| 47 | @param failure 失败回调 | 47 | @param failure 失败回调 |
| 48 | */ | 48 | */ |
| 49 | -+ (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 (^)(NSError *error))failure; | 49 | ++ (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; |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| 52 | @abstract 快捷登录 | 52 | @abstract 快捷登录 |
| @@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
| 56 | @param success 成功回调 | 56 | @param success 成功回调 |
| 57 | @param failure 失败回调 | 57 | @param failure 失败回调 |
| 58 | */ | 58 | */ |
| 59 | -+ (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 59 | ++ (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 60 | 60 | ||
| 61 | /** | 61 | /** |
| 62 | @abstract 登录 | 62 | @abstract 登录 |
| @@ -66,7 +66,7 @@ | @@ -66,7 +66,7 @@ | ||
| 66 | @param success 成功回调 | 66 | @param success 成功回调 |
| 67 | @param failure 失败回调 | 67 | @param failure 失败回调 |
| 68 | */ | 68 | */ |
| 69 | -+ (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 69 | ++ (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 70 | 70 | ||
| 71 | /** | 71 | /** |
| 72 | @abstract 发送验证码 | 72 | @abstract 发送验证码 |
| @@ -75,7 +75,7 @@ | @@ -75,7 +75,7 @@ | ||
| 75 | @param success 成功回调 | 75 | @param success 成功回调 |
| 76 | @param failure 失败回调 | 76 | @param failure 失败回调 |
| 77 | */ | 77 | */ |
| 78 | -+ (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 78 | ++ (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 79 | 79 | ||
| 80 | /** | 80 | /** |
| 81 | @abstract 更新用户附加信息 | 81 | @abstract 更新用户附加信息 |
| @@ -84,7 +84,7 @@ | @@ -84,7 +84,7 @@ | ||
| 84 | @param success 成功回调 | 84 | @param success 成功回调 |
| 85 | @param failure 失败回调 | 85 | @param failure 失败回调 |
| 86 | */ | 86 | */ |
| 87 | -+ (void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 87 | ++ (void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 88 | 88 | ||
| 89 | /** | 89 | /** |
| 90 | @abstract 修改用户单项信息 | 90 | @abstract 修改用户单项信息 |
| @@ -94,7 +94,7 @@ | @@ -94,7 +94,7 @@ | ||
| 94 | @param success 成功回调 | 94 | @param success 成功回调 |
| 95 | @param failure 失败回调 | 95 | @param failure 失败回调 |
| 96 | */ | 96 | */ |
| 97 | -+ (void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 97 | ++ (void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 98 | 98 | ||
| 99 | /** | 99 | /** |
| 100 | @abstract 更新手机号 | 100 | @abstract 更新手机号 |
| @@ -104,7 +104,7 @@ | @@ -104,7 +104,7 @@ | ||
| 104 | @param success 成功回调 | 104 | @param success 成功回调 |
| 105 | @param failure 失败回调 | 105 | @param failure 失败回调 |
| 106 | */ | 106 | */ |
| 107 | -+ (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 107 | ++ (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 108 | 108 | ||
| 109 | /** | 109 | /** |
| 110 | @abstract 修改密码(通过手机号修改) | 110 | @abstract 修改密码(通过手机号修改) |
| @@ -114,7 +114,7 @@ | @@ -114,7 +114,7 @@ | ||
| 114 | @param success 成功回调 | 114 | @param success 成功回调 |
| 115 | @param failure 失败回调 | 115 | @param failure 失败回调 |
| 116 | */ | 116 | */ |
| 117 | -+ (void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 117 | ++ (void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 118 | 118 | ||
| 119 | /** | 119 | /** |
| 120 | @abstract 上传头像 | 120 | @abstract 上传头像 |
| @@ -123,7 +123,7 @@ | @@ -123,7 +123,7 @@ | ||
| 123 | @param success 成功回调 | 123 | @param success 成功回调 |
| 124 | @param failure 失败回调 | 124 | @param failure 失败回调 |
| 125 | */ | 125 | */ |
| 126 | -+ (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 126 | ++ (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 127 | 127 | ||
| 128 | /** | 128 | /** |
| 129 | @abstract 查询用户信息 | 129 | @abstract 查询用户信息 |
| @@ -132,7 +132,7 @@ | @@ -132,7 +132,7 @@ | ||
| 132 | @param success 成功回调 | 132 | @param success 成功回调 |
| 133 | @param failure 失败回调 | 133 | @param failure 失败回调 |
| 134 | */ | 134 | */ |
| 135 | -+ (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 135 | ++ (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 136 | 136 | ||
| 137 | /** | 137 | /** |
| 138 | @abstract 用户反馈 | 138 | @abstract 用户反馈 |
| @@ -141,7 +141,7 @@ | @@ -141,7 +141,7 @@ | ||
| 141 | @param success 成功回调 | 141 | @param success 成功回调 |
| 142 | @param failure 失败回调 | 142 | @param failure 失败回调 |
| 143 | */ | 143 | */ |
| 144 | -+ (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 144 | ++ (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure:(void (^)(NSDictionary *errorDic))failure; |
| 145 | 145 | ||
| 146 | /** | 146 | /** |
| 147 | * 获取SDK版本号 | 147 | * 获取SDK版本号 |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveUserSystemCenter.m
| @@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
| 31 | /** | 31 | /** |
| 32 | * 注册 | 32 | * 注册 |
| 33 | */ | 33 | */ |
| 34 | -+ (void)registerWithUserName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure | 34 | ++ (void)registerWithUserName:(NSString *)userName password:(NSString *)password verificationCode:(NSString *)verificationCode invitationCode:(NSString *)invitationCode frmId:(NSString *)frmId success:(void (^)(id))success failure :(void (^)(NSDictionary *))failure |
| 35 | { | 35 | { |
| 36 | CNLiveRegister *userRegister = [[CNLiveRegister alloc] init]; | 36 | CNLiveRegister *userRegister = [[CNLiveRegister alloc] init]; |
| 37 | 37 | ||
| @@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
| 41 | /** | 41 | /** |
| 42 | * 第三方登录 | 42 | * 第三方登录 |
| 43 | */ | 43 | */ |
| 44 | -+ (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 (^)(NSError *))failure | 44 | ++ (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))success failure:(void (^)(NSDictionary *))failure |
| 45 | { | 45 | { |
| 46 | CNLiveLogin *thirdLogin = [[CNLiveLogin alloc] init]; | 46 | CNLiveLogin *thirdLogin = [[CNLiveLogin alloc] init]; |
| 47 | 47 | ||
| @@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
| 52 | * 快捷登录 | 52 | * 快捷登录 |
| 53 | */ | 53 | */ |
| 54 | 54 | ||
| 55 | -+ (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure | 55 | ++ (void)shortcutLoginWithUserName:(NSString *)userName verificationCode:(NSString *)verificationCode frmId:(NSString *)frmId success:(void (^)(id))success failure :(void (^)(NSDictionary *))failure |
| 56 | { | 56 | { |
| 57 | CNLiveLogin *shortcutLogin = [[CNLiveLogin alloc] init]; | 57 | CNLiveLogin *shortcutLogin = [[CNLiveLogin alloc] init]; |
| 58 | 58 | ||
| @@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
| 62 | /** | 62 | /** |
| 63 | * 登录 | 63 | * 登录 |
| 64 | */ | 64 | */ |
| 65 | -+ (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id result))success failure :(void (^)(NSError *error))failure | 65 | ++ (void)loginWithUserName:(NSString *)userName password:(NSString *)password frmId:(NSString *)frmId success:(void (^)(id))success failure :(void (^)(NSDictionary *))failure |
| 66 | { | 66 | { |
| 67 | CNLiveLogin *login = [[CNLiveLogin alloc] init]; | 67 | CNLiveLogin *login = [[CNLiveLogin alloc] init]; |
| 68 | 68 | ||
| @@ -72,7 +72,7 @@ | @@ -72,7 +72,7 @@ | ||
| 72 | /** | 72 | /** |
| 73 | * 发送验证码 | 73 | * 发送验证码 |
| 74 | */ | 74 | */ |
| 75 | -+ (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure :(void (^)(NSError *error))failure | 75 | ++ (void)verificationCodeType:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id))success failure :(void (^)(NSDictionary *))failure |
| 76 | { | 76 | { |
| 77 | CNLiveVerificationCode *verification = [[CNLiveVerificationCode alloc] init]; | 77 | CNLiveVerificationCode *verification = [[CNLiveVerificationCode alloc] init]; |
| 78 | 78 | ||
| @@ -82,7 +82,7 @@ | @@ -82,7 +82,7 @@ | ||
| 82 | /** | 82 | /** |
| 83 | * 更新用户附加信息 | 83 | * 更新用户附加信息 |
| 84 | */ | 84 | */ |
| 85 | -+ (void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id result))success failure:(void (^)(NSError *))failure | 85 | ++(void)updateOtherInfoWithUid:(NSString *)uid extInfo:(NSString *)extInfo success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| 86 | { | 86 | { |
| 87 | CNLiveUserInfo *updateOtherInfo = [[CNLiveUserInfo alloc] init]; | 87 | CNLiveUserInfo *updateOtherInfo = [[CNLiveUserInfo alloc] init]; |
| 88 | 88 | ||
| @@ -92,7 +92,7 @@ | @@ -92,7 +92,7 @@ | ||
| 92 | /** | 92 | /** |
| 93 | * 修改用户单项信息 | 93 | * 修改用户单项信息 |
| 94 | */ | 94 | */ |
| 95 | -+ (void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id result))success failure :(void (^)(NSError *error))failure | 95 | ++(void)modifyUserInfoType:(UserInfoType)type uid:(NSString *)uid modifyInfo:(NSString *)info success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| 96 | { | 96 | { |
| 97 | CNLiveUserInfo *updateUserInfo = [[CNLiveUserInfo alloc] init]; | 97 | CNLiveUserInfo *updateUserInfo = [[CNLiveUserInfo alloc] init]; |
| 98 | 98 | ||
| @@ -102,7 +102,7 @@ | @@ -102,7 +102,7 @@ | ||
| 102 | /** | 102 | /** |
| 103 | * 更新手机号 | 103 | * 更新手机号 |
| 104 | */ | 104 | */ |
| 105 | -+ (void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id result))success failure :(void (^)(NSError *error))failure | 105 | ++(void)updateMobileWithUid:(NSString *)uid mobile:(NSString *)mobile verificationCode:(NSString *)verificationCode success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| 106 | { | 106 | { |
| 107 | CNLiveUserInfo *updateMobile = [[CNLiveUserInfo alloc] init]; | 107 | CNLiveUserInfo *updateMobile = [[CNLiveUserInfo alloc] init]; |
| 108 | 108 | ||
| @@ -112,7 +112,7 @@ | @@ -112,7 +112,7 @@ | ||
| 112 | /** | 112 | /** |
| 113 | * 修改密码 | 113 | * 修改密码 |
| 114 | */ | 114 | */ |
| 115 | -+ (void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id result))success failure :(void (^)(NSError *error))failure | 115 | ++(void)changePasswordWithMobile:(NSString *)mobile verificationCode:(NSString *)verificationCode newPassword:(NSString *)newPassword success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| 116 | { | 116 | { |
| 117 | CNLiveUserInfo *password = [[CNLiveUserInfo alloc] init]; | 117 | CNLiveUserInfo *password = [[CNLiveUserInfo alloc] init]; |
| 118 | 118 | ||
| @@ -123,7 +123,7 @@ | @@ -123,7 +123,7 @@ | ||
| 123 | /** | 123 | /** |
| 124 | * 上传头像 | 124 | * 上传头像 |
| 125 | */ | 125 | */ |
| 126 | -+ (void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id))success failure:(void (^)(NSError *))failure | 126 | ++(void)uploadIconWithUid:(NSString *)uid icon:(UIImage *)icon success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| 127 | { | 127 | { |
| 128 | CNLiveUploadIcon *uplodIcon = [[CNLiveUploadIcon alloc] init]; | 128 | CNLiveUploadIcon *uplodIcon = [[CNLiveUploadIcon alloc] init]; |
| 129 | [uplodIcon uploadIconWithAppId:[CNLiveUserManager manager].appId uid:uid icon:icon token:[[self class] getToken] secret:[CNLiveUserManager manager].appSecret success:success failure:failure]; | 129 | [uplodIcon uploadIconWithAppId:[CNLiveUserManager manager].appId uid:uid icon:icon token:[[self class] getToken] secret:[CNLiveUserManager manager].appSecret success:success failure:failure]; |
| @@ -132,7 +132,7 @@ | @@ -132,7 +132,7 @@ | ||
| 132 | /** | 132 | /** |
| 133 | * 查询用户信息 | 133 | * 查询用户信息 |
| 134 | */ | 134 | */ |
| 135 | -+ (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id result))success failure :(void (^)(NSError *error))failure | 135 | ++ (void)queryUserInfoWithUid:(NSString *)uid srcUid:(NSString *)srcUid success:(void (^)(id))success failure:(void (^)(NSDictionary *))failure |
| 136 | { | 136 | { |
| 137 | CNLiveUserInfo *userInfo = [[CNLiveUserInfo alloc] init]; | 137 | CNLiveUserInfo *userInfo = [[CNLiveUserInfo alloc] init]; |
| 138 | 138 | ||
| @@ -142,7 +142,7 @@ | @@ -142,7 +142,7 @@ | ||
| 142 | /** | 142 | /** |
| 143 | * 用户反馈 | 143 | * 用户反馈 |
| 144 | */ | 144 | */ |
| 145 | -+ (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id result))success failure :(void (^)(NSError *error))failure | 145 | ++ (void)feedbackWithContentId:(NSString *)contentId message:(NSString *)message success:(void (^)(id))success failure :(void (^)(NSDictionary *errorDic))failure |
| 146 | { | 146 | { |
| 147 | CNLiveFeedback *feedback = [[CNLiveFeedback alloc] init]; | 147 | CNLiveFeedback *feedback = [[CNLiveFeedback alloc] init]; |
| 148 | 148 |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveVerificationCode.h
| @@ -11,6 +11,6 @@ | @@ -11,6 +11,6 @@ | ||
| 11 | 11 | ||
| 12 | @interface CNLiveVerificationCode : NSObject | 12 | @interface CNLiveVerificationCode : NSObject |
| 13 | 13 | ||
| 14 | -- (void)getVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure :(void (^)(NSError *error))failure; | 14 | +- (void)getVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure; |
| 15 | 15 | ||
| 16 | @end | 16 | @end |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/CNLiveVerificationCode.m
| @@ -22,7 +22,7 @@ static NSString *passwordURL = @"https://api.cnlive.com/open/api2/user/sendVeri | @@ -22,7 +22,7 @@ static NSString *passwordURL = @"https://api.cnlive.com/open/api2/user/sendVeri | ||
| 22 | 22 | ||
| 23 | @implementation CNLiveVerificationCode | 23 | @implementation CNLiveVerificationCode |
| 24 | 24 | ||
| 25 | -- (void)getVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure:(void (^)(NSError *))failure | 25 | +- (void)getVerificationCodeWithAppId:(NSString *)appId appKey:(NSString *)appKey type:(VerificationCodeType)type mobile:(NSString *)mobile success:(void (^)(id result))success failure:(void (^)(NSDictionary *))failure |
| 26 | { | 26 | { |
| 27 | NSDate *date = [NSDate date]; | 27 | NSDate *date = [NSDate date]; |
| 28 | NSInteger time = [date timeIntervalSince1970]; | 28 | NSInteger time = [date timeIntervalSince1970]; |
| @@ -45,7 +45,7 @@ static NSString *passwordURL = @"https://api.cnlive.com/open/api2/user/sendVeri | @@ -45,7 +45,7 @@ static NSString *passwordURL = @"https://api.cnlive.com/open/api2/user/sendVeri | ||
| 45 | 45 | ||
| 46 | #pragma mark - request | 46 | #pragma mark - request |
| 47 | 47 | ||
| 48 | -- (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSError * error))failure | 48 | +- (void)requestWithURL:(NSString *)URL parameter:(NSDictionary *)param success:(void(^)(id result))success failure :(void (^)(NSDictionary *errorDic))failure |
| 49 | { | 49 | { |
| 50 | [[CNLiveNetworkManager manager] requestPostURL:URL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { | 50 | [[CNLiveNetworkManager manager] requestPostURL:URL parameters:param success:^(NSURLResponse * _Nullable response, id _Nullable responseObject) { |
| 51 | 51 | ||
| @@ -53,19 +53,27 @@ static NSString *passwordURL = @"https://api.cnlive.com/open/api2/user/sendVeri | @@ -53,19 +53,27 @@ static NSString *passwordURL = @"https://api.cnlive.com/open/api2/user/sendVeri | ||
| 53 | 53 | ||
| 54 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | 54 | if ([[responseObject allKeys] containsObject:@"errorCode"] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { |
| 55 | 55 | ||
| 56 | - success(responseObject); | 56 | + if (success) { |
| 57 | + success(responseObject); | ||
| 58 | + } | ||
| 57 | 59 | ||
| 58 | } else { | 60 | } else { |
| 59 | 61 | ||
| 60 | - NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:[responseObject[@"errorCode"] integerValue] userInfo:@{NSLocalizedDescriptionKey : responseObject[@"errorMessage"]}]; | ||
| 61 | - failure(error); | 62 | + if (failure) { |
| 63 | + failure(responseObject); | ||
| 64 | + } | ||
| 62 | 65 | ||
| 63 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; | 66 | [CNLiveUserSystemTools errorStat:responseObject[@"errorMessage"]]; |
| 64 | } | 67 | } |
| 65 | 68 | ||
| 66 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { | 69 | } failure:^(NSURLResponse * _Nullable response, NSError * _Nullable error) { |
| 67 | 70 | ||
| 68 | - failure(error); | 71 | + NSDictionary *errorDic = @{@"errorCode": [NSString stringWithFormat:@"%ld", error.code], @"errorMessage": error.localizedDescription}; |
| 72 | + | ||
| 73 | + if (failure) { | ||
| 74 | + failure(errorDic); | ||
| 75 | + } | ||
| 76 | + | ||
| 69 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; | 77 | [CNLiveUserSystemTools errorStat:error.localizedDescription]; |
| 70 | 78 | ||
| 71 | }]; | 79 | }]; |
CNLiveUserSystemDemo/CNLiveUserSystemSDK/Common.h
| @@ -11,6 +11,6 @@ | @@ -11,6 +11,6 @@ | ||
| 11 | 11 | ||
| 12 | #define kSVer @"4.0" //探针版本 | 12 | #define kSVer @"4.0" //探针版本 |
| 13 | #define StatAppVersion ([[[NSBundle mainBundle] infoDictionary] objectForKey: @"CFBundleShortVersionString"]) | 13 | #define StatAppVersion ([[[NSBundle mainBundle] infoDictionary] objectForKey: @"CFBundleShortVersionString"]) |
| 14 | -#define SDKVersion @"1.1.1" //SDK版本 | 14 | +#define SDKVersion @"1.1.2" //SDK版本 |
| 15 | 15 | ||
| 16 | #endif /* Common_h */ | 16 | #endif /* Common_h */ |
CNLiveUserSystemDemo/Conreollers/LoginViewController.m
| @@ -53,22 +53,18 @@ | @@ -53,22 +53,18 @@ | ||
| 53 | { | 53 | { |
| 54 | [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear]; | 54 | [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear]; |
| 55 | [SVProgressHUD show]; | 55 | [SVProgressHUD show]; |
| 56 | - | ||
| 57 | - [CNLiveUserSystemCenter loginWithUserName:_idAndPwdView.idTF.text password:_idAndPwdView.pwdTF.text frmId:nil success:^(id result) { | 56 | + |
| 57 | + [CNLiveUserSystemCenter loginWithUserName:@"941123686@qq.com" password:@"123456" frmId:nil success:^(id result) { | ||
| 58 | 58 | ||
| 59 | NSLog(@"登录 success------------%@",result); | 59 | NSLog(@"登录 success------------%@",result); |
| 60 | - | ||
| 61 | - [Tools setUserLogin:YES]; | ||
| 62 | [SVProgressHUD showSuccessWithStatus:@"登录成功"]; | 60 | [SVProgressHUD showSuccessWithStatus:@"登录成功"]; |
| 63 | [UserInfoSava saveUserinfoDic:result[@"data"]]; | 61 | [UserInfoSava saveUserinfoDic:result[@"data"]]; |
| 62 | + [Tools setUserLogin:YES]; | ||
| 64 | [self.navigationController popViewControllerAnimated:YES]; | 63 | [self.navigationController popViewControllerAnimated:YES]; |
| 65 | - | ||
| 66 | - | ||
| 67 | - } failure:^(NSError *error) { | ||
| 68 | 64 | ||
| 69 | - [Tools toast:error.localizedDescription]; | 65 | + } failure:^(NSDictionary *errorDic) { |
| 66 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 70 | [SVProgressHUD dismiss]; | 67 | [SVProgressHUD dismiss]; |
| 71 | - | ||
| 72 | }]; | 68 | }]; |
| 73 | } | 69 | } |
| 74 | 70 |
CNLiveUserSystemDemo/Conreollers/ModifyUserInfoViewController.m
| @@ -50,8 +50,8 @@ | @@ -50,8 +50,8 @@ | ||
| 50 | [SVProgressHUD showSuccessWithStatus:@"手机号修改成功"]; | 50 | [SVProgressHUD showSuccessWithStatus:@"手机号修改成功"]; |
| 51 | [self.navigationController popViewControllerAnimated:YES]; | 51 | [self.navigationController popViewControllerAnimated:YES]; |
| 52 | 52 | ||
| 53 | - } failure:^(NSError *error) { | ||
| 54 | - [Tools toast:error.localizedDescription]; | 53 | + } failure:^(NSDictionary *errorDic) { |
| 54 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 55 | [SVProgressHUD dismiss]; | 55 | [SVProgressHUD dismiss]; |
| 56 | }]; | 56 | }]; |
| 57 | 57 | ||
| @@ -63,10 +63,9 @@ | @@ -63,10 +63,9 @@ | ||
| 63 | [SVProgressHUD showSuccessWithStatus:@"修改成功"]; | 63 | [SVProgressHUD showSuccessWithStatus:@"修改成功"]; |
| 64 | [self.navigationController popViewControllerAnimated:YES]; | 64 | [self.navigationController popViewControllerAnimated:YES]; |
| 65 | 65 | ||
| 66 | - } failure:^(NSError *error) { | ||
| 67 | - [Tools toast:error.localizedDescription]; | 66 | + } failure:^(NSDictionary *errorDic) { |
| 67 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 68 | [SVProgressHUD dismiss]; | 68 | [SVProgressHUD dismiss]; |
| 69 | - | ||
| 70 | }]; | 69 | }]; |
| 71 | } | 70 | } |
| 72 | } | 71 | } |
| @@ -79,8 +78,8 @@ | @@ -79,8 +78,8 @@ | ||
| 79 | 78 | ||
| 80 | [Tools toast:result[@"errorMessage"]]; | 79 | [Tools toast:result[@"errorMessage"]]; |
| 81 | 80 | ||
| 82 | - } failure:^(NSError *error) { | ||
| 83 | - [Tools toast:error.localizedDescription]; | 81 | + } failure:^(NSDictionary *errorDic) { |
| 82 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 84 | }]; | 83 | }]; |
| 85 | } | 84 | } |
| 86 | 85 |
CNLiveUserSystemDemo/Conreollers/RegisterViewController.m
| @@ -49,8 +49,8 @@ | @@ -49,8 +49,8 @@ | ||
| 49 | 49 | ||
| 50 | [Tools toast:result[@"errorMessage"]]; | 50 | [Tools toast:result[@"errorMessage"]]; |
| 51 | 51 | ||
| 52 | - } failure:^(NSError *error) { | ||
| 53 | - [Tools toast:error.localizedDescription]; | 52 | + } failure:^(NSDictionary *errorDic) { |
| 53 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 54 | }]; | 54 | }]; |
| 55 | 55 | ||
| 56 | } else if ([_type isEqualToString:@"quicklyLogin"]) { | 56 | } else if ([_type isEqualToString:@"quicklyLogin"]) { |
| @@ -59,9 +59,8 @@ | @@ -59,9 +59,8 @@ | ||
| 59 | 59 | ||
| 60 | [Tools toast:result[@"errorMessage"]]; | 60 | [Tools toast:result[@"errorMessage"]]; |
| 61 | 61 | ||
| 62 | - } failure:^(NSError *error) { | ||
| 63 | - | ||
| 64 | - [Tools toast:error.localizedDescription]; | 62 | + } failure:^(NSDictionary *errorDic) { |
| 63 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 65 | }]; | 64 | }]; |
| 66 | 65 | ||
| 67 | } else { | 66 | } else { |
| @@ -70,9 +69,8 @@ | @@ -70,9 +69,8 @@ | ||
| 70 | 69 | ||
| 71 | [Tools toast:result[@"errorMessage"]]; | 70 | [Tools toast:result[@"errorMessage"]]; |
| 72 | 71 | ||
| 73 | - } failure:^(NSError *error) { | ||
| 74 | - | ||
| 75 | - [Tools toast:error.localizedDescription]; | 72 | + } failure:^(NSDictionary *errorDic) { |
| 73 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 76 | }]; | 74 | }]; |
| 77 | } | 75 | } |
| 78 | } | 76 | } |
| @@ -92,11 +90,9 @@ | @@ -92,11 +90,9 @@ | ||
| 92 | [UserInfoSava saveUserinfoDic:result[@"data"]]; | 90 | [UserInfoSava saveUserinfoDic:result[@"data"]]; |
| 93 | [self.navigationController popToRootViewControllerAnimated:YES]; | 91 | [self.navigationController popToRootViewControllerAnimated:YES]; |
| 94 | 92 | ||
| 95 | - } failure:^(NSError *error) { | ||
| 96 | - | ||
| 97 | - [Tools toast:error.localizedDescription]; | 93 | + } failure:^(NSDictionary *errorDic) { |
| 98 | [SVProgressHUD dismiss]; | 94 | [SVProgressHUD dismiss]; |
| 99 | - | 95 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; |
| 100 | }]; | 96 | }]; |
| 101 | 97 | ||
| 102 | } else if ([_type isEqualToString:@"quicklyLogin"]) { | 98 | } else if ([_type isEqualToString:@"quicklyLogin"]) { |
| @@ -108,11 +104,9 @@ | @@ -108,11 +104,9 @@ | ||
| 108 | [UserInfoSava saveUserinfoDic:result[@"data"]]; | 104 | [UserInfoSava saveUserinfoDic:result[@"data"]]; |
| 109 | [self.navigationController popToRootViewControllerAnimated:YES]; | 105 | [self.navigationController popToRootViewControllerAnimated:YES]; |
| 110 | 106 | ||
| 111 | - } failure:^(NSError *error) { | ||
| 112 | - | ||
| 113 | - [Tools toast:error.localizedDescription]; | 107 | + } failure:^(NSDictionary *errorDic) { |
| 108 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 114 | [SVProgressHUD dismiss]; | 109 | [SVProgressHUD dismiss]; |
| 115 | - | ||
| 116 | }]; | 110 | }]; |
| 117 | 111 | ||
| 118 | } else { | 112 | } else { |
| @@ -121,10 +115,9 @@ | @@ -121,10 +115,9 @@ | ||
| 121 | [SVProgressHUD showSuccessWithStatus:@"密码修改成功"]; | 115 | [SVProgressHUD showSuccessWithStatus:@"密码修改成功"]; |
| 122 | [self.navigationController popToRootViewControllerAnimated:YES]; | 116 | [self.navigationController popToRootViewControllerAnimated:YES]; |
| 123 | 117 | ||
| 124 | - } failure:^(NSError *error) { | ||
| 125 | - [Tools toast:error.localizedDescription]; | 118 | + } failure:^(NSDictionary *errorDic) { |
| 119 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 126 | [SVProgressHUD dismiss]; | 120 | [SVProgressHUD dismiss]; |
| 127 | - | ||
| 128 | }]; | 121 | }]; |
| 129 | } | 122 | } |
| 130 | 123 |
CNLiveUserSystemDemo/Conreollers/UserInfoViewController.m
| @@ -193,8 +193,8 @@ | @@ -193,8 +193,8 @@ | ||
| 193 | NSLog(@"%@",result); | 193 | NSLog(@"%@",result); |
| 194 | [SVProgressHUD showSuccessWithStatus:@"修改成功"]; | 194 | [SVProgressHUD showSuccessWithStatus:@"修改成功"]; |
| 195 | 195 | ||
| 196 | - } failure:^(NSError *error) { | ||
| 197 | - [Tools toast:error.localizedDescription]; | 196 | + } failure:^(NSDictionary *errorDic) { |
| 197 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 198 | [SVProgressHUD dismiss]; | 198 | [SVProgressHUD dismiss]; |
| 199 | }]; | 199 | }]; |
| 200 | } | 200 | } |
| @@ -227,8 +227,8 @@ | @@ -227,8 +227,8 @@ | ||
| 227 | 227 | ||
| 228 | NSLog(@"%@",result); | 228 | NSLog(@"%@",result); |
| 229 | 229 | ||
| 230 | - } failure:^(NSError *error) { | ||
| 231 | - [Tools toast:error.localizedDescription]; | 230 | + } failure:^(NSDictionary *errorDic) { |
| 231 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 232 | }]; | 232 | }]; |
| 233 | 233 | ||
| 234 | } else { | 234 | } else { |
CNLiveUserSystemDemo/Conreollers/ViewController.m
| @@ -132,8 +132,8 @@ | @@ -132,8 +132,8 @@ | ||
| 132 | [SVProgressHUD showSuccessWithStatus:@"更新附加信息成功"]; | 132 | [SVProgressHUD showSuccessWithStatus:@"更新附加信息成功"]; |
| 133 | [self.navigationController popViewControllerAnimated:YES]; | 133 | [self.navigationController popViewControllerAnimated:YES]; |
| 134 | 134 | ||
| 135 | - } failure:^(NSError *error) { | ||
| 136 | - [Tools toast:error.localizedDescription]; | 135 | + } failure:^(NSDictionary *errorDic) { |
| 136 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 137 | [SVProgressHUD dismiss]; | 137 | [SVProgressHUD dismiss]; |
| 138 | }]; | 138 | }]; |
| 139 | } | 139 | } |
| @@ -157,8 +157,8 @@ | @@ -157,8 +157,8 @@ | ||
| 157 | [_tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationFade]; | 157 | [_tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationFade]; |
| 158 | [Tools toast:message]; | 158 | [Tools toast:message]; |
| 159 | 159 | ||
| 160 | - } failure:^(NSError *error) { | ||
| 161 | - [Tools toast:error.localizedDescription]; | 160 | + } failure:^(NSDictionary *errorDic) { |
| 161 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 162 | }]; | 162 | }]; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| @@ -167,8 +167,8 @@ | @@ -167,8 +167,8 @@ | ||
| 167 | [CNLiveUserSystemCenter feedbackWithContentId:@"11" message:@"fhsjhifkncznshfu" success:^(id result) { | 167 | [CNLiveUserSystemCenter feedbackWithContentId:@"11" message:@"fhsjhifkncznshfu" success:^(id result) { |
| 168 | [Tools toast:[NSString stringWithFormat:@"反馈--%@",result[@"errorMessage"]]]; | 168 | [Tools toast:[NSString stringWithFormat:@"反馈--%@",result[@"errorMessage"]]]; |
| 169 | 169 | ||
| 170 | - } failure:^(NSError *error) { | ||
| 171 | - [Tools toast:error.localizedDescription]; | 170 | + } failure:^(NSDictionary *errorDic) { |
| 171 | + [Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]]; | ||
| 172 | }]; | 172 | }]; |
| 173 | } | 173 | } |
| 174 | } | 174 | } |
CNLiveUserSystemDemo/Tools/CNLiveThirdLoginManager.m
| @@ -114,7 +114,7 @@ | @@ -114,7 +114,7 @@ | ||
| 114 | NSString *gender; | 114 | NSString *gender; |
| 115 | if ([[result objectForKey:@"gender"] isEqualToString:@"女"]) { | 115 | if ([[result objectForKey:@"gender"] isEqualToString:@"女"]) { |
| 116 | gender = @"f"; | 116 | gender = @"f"; |
| 117 | - } else if ([[result objectForKey:@"gender"] isEqualToString:@"女"]) { | 117 | + } else if ([[result objectForKey:@"gender"] isEqualToString:@"男"]) { |
| 118 | gender = @"m"; | 118 | gender = @"m"; |
| 119 | } else { | 119 | } else { |
| 120 | gender = @"n"; | 120 | gender = @"n"; |
| @@ -128,7 +128,7 @@ | @@ -128,7 +128,7 @@ | ||
| 128 | [UserInfoSava saveUserinfoDic:result[@"data"]]; | 128 | [UserInfoSava saveUserinfoDic:result[@"data"]]; |
| 129 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | 129 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; |
| 130 | 130 | ||
| 131 | - } failure:^(NSError *error) { | 131 | + } failure:^(NSDictionary *errorDic) { |
| 132 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | 132 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; |
| 133 | }]; | 133 | }]; |
| 134 | } | 134 | } |
| @@ -252,7 +252,7 @@ | @@ -252,7 +252,7 @@ | ||
| 252 | [UserInfoSava saveUserinfoDic:result[@"data"]]; | 252 | [UserInfoSava saveUserinfoDic:result[@"data"]]; |
| 253 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | 253 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; |
| 254 | 254 | ||
| 255 | - } failure:^(NSError *error) { | 255 | + } failure:^(NSDictionary *errorDic) { |
| 256 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | 256 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; |
| 257 | }]; | 257 | }]; |
| 258 | } | 258 | } |
| @@ -308,10 +308,9 @@ | @@ -308,10 +308,9 @@ | ||
| 308 | [UserInfoSava saveUserinfoDic:result[@"data"]]; | 308 | [UserInfoSava saveUserinfoDic:result[@"data"]]; |
| 309 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; | 309 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginSuccess object:nil userInfo:nil]; |
| 310 | 310 | ||
| 311 | - } failure:^(NSError *error) { | 311 | + } failure:^(NSDictionary *errorDic) { |
| 312 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; | 312 | [[NSNotificationCenter defaultCenter] postNotificationName:ThirdLoginFailure object:nil userInfo:nil]; |
| 313 | }]; | 313 | }]; |
| 314 | - | ||
| 315 | } | 314 | } |
| 316 | } | 315 | } |
| 317 | 316 |
CNLiveUserSystemSDK.xcodeproj/project.pbxproj
| @@ -379,6 +379,7 @@ | @@ -379,6 +379,7 @@ | ||
| 379 | INFOPLIST_FILE = CNLiveUserSystemSDK/Info.plist; | 379 | INFOPLIST_FILE = CNLiveUserSystemSDK/Info.plist; |
| 380 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; | 380 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; |
| 381 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; | 381 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; |
| 382 | + MACH_O_TYPE = staticlib; | ||
| 382 | PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveUserSystemSDK; | 383 | PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveUserSystemSDK; |
| 383 | PRODUCT_NAME = "$(TARGET_NAME)"; | 384 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 384 | SKIP_INSTALL = YES; | 385 | SKIP_INSTALL = YES; |
| @@ -396,6 +397,7 @@ | @@ -396,6 +397,7 @@ | ||
| 396 | INFOPLIST_FILE = CNLiveUserSystemSDK/Info.plist; | 397 | INFOPLIST_FILE = CNLiveUserSystemSDK/Info.plist; |
| 397 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; | 398 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; |
| 398 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; | 399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; |
| 400 | + MACH_O_TYPE = staticlib; | ||
| 399 | PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveUserSystemSDK; | 401 | PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveUserSystemSDK; |
| 400 | PRODUCT_NAME = "$(TARGET_NAME)"; | 402 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 401 | SKIP_INSTALL = YES; | 403 | SKIP_INSTALL = YES; |
CNLiveUserSystemSDK.xcodeproj/project.xcworkspace/xcuserdata/iOS.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
CNLiveUserSystemSDK/Info.plist
| @@ -15,9 +15,9 @@ | @@ -15,9 +15,9 @@ | ||
| 15 | <key>CFBundlePackageType</key> | 15 | <key>CFBundlePackageType</key> |
| 16 | <string>FMWK</string> | 16 | <string>FMWK</string> |
| 17 | <key>CFBundleShortVersionString</key> | 17 | <key>CFBundleShortVersionString</key> |
| 18 | - <string>1.1.1</string> | 18 | + <string>1.1.2</string> |
| 19 | <key>CFBundleVersion</key> | 19 | <key>CFBundleVersion</key> |
| 20 | - <string>1.1.1.110113</string> | 20 | + <string>1.1.12.111714</string> |
| 21 | <key>NSPrincipalClass</key> | 21 | <key>NSPrincipalClass</key> |
| 22 | <string></string> | 22 | <string></string> |
| 23 | </dict> | 23 | </dict> |
Products/CNLiveUserSystemSDK.framework/CNLiveUserSystemSDK
100755 → 100644
No preview for this file type
Products/CNLiveUserSystemSDK.framework/Info.plist
No preview for this file type
用户系统.pages
0 → 100644
No preview for this file type