diff --git a/.gitignore b/.gitignore index 985f114..69c09f2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ *.xcuserstate *.xcuserstate + +*.xcuserstate + +WeiboSDKDemo/WeiboSDKLibDemo.xcodeproj/project.xcworkspace/xcuserdata/hongtao.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/WeiboSDKDemo/WeiboSDKLibDemo.xcodeproj/project.xcworkspace/xcuserdata/hongtao.xcuserdatad/UserInterfaceState.xcuserstate b/WeiboSDKDemo/WeiboSDKLibDemo.xcodeproj/project.xcworkspace/xcuserdata/hongtao.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index de8d56f..0000000 Binary files a/WeiboSDKDemo/WeiboSDKLibDemo.xcodeproj/project.xcworkspace/xcuserdata/hongtao.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/WeiboSDKDemo/libWeiboSDK/WeiboSDK.h b/WeiboSDKDemo/libWeiboSDK/WeiboSDK.h index b2cb21b..9f9b1b7 100644 --- a/WeiboSDKDemo/libWeiboSDK/WeiboSDK.h +++ b/WeiboSDKDemo/libWeiboSDK/WeiboSDK.h @@ -162,6 +162,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @end +#pragma mark - WBHttpRequest and WBHttpRequestDelegate + /** 接收并处理来自微博sdk对于网络请求接口的调用响应 以及openAPI 如inviteFriend、logOutWithToken的请求 @@ -209,16 +211,32 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) */ @interface WBHttpRequest : NSObject { - NSString *url; - NSString *httpMethod; - NSDictionary *params; - NSURLConnection *connection; NSMutableData *responseData; - - id delegate; } +/** + 用户自定义请求地址URL + */ +@property (nonatomic, retain) NSString *url; + +/** + 用户自定义请求方式 + + 支持"GET" "POST" + */ +@property (nonatomic, retain) NSString *httpMethod; + +/** + 用户自定义请求参数字典 + */ +@property (nonatomic, retain) NSDictionary *params; + +/** + WBHttpRequestDelegate对象,用于接收微博SDK对于发起的接口请求的请求的响应 + */ +@property (nonatomic, assign) id delegate; + /** 用户自定义TAG @@ -235,7 +253,7 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @param delegate WBHttpRequestDelegate对象,用于接收微博SDK对于发起的接口请求的请求的响应 @param tag 用户自定义TAG,将通过回调WBHttpRequest实例的tag属性返回 */ -+ (void)requestWithURL:(NSString *)url ++ (WBHttpRequest *)requestWithURL:(NSString *)url httpMethod:(NSString *)httpMethod params:(NSDictionary *)params delegate:(id)delegate @@ -252,12 +270,17 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @param delegate WBHttpRequestDelegate对象,用于接收微博SDK对于发起的接口请求的请求的响应 @param tag 用户自定义TAG,将通过回调WBHttpRequest实例的tag属性返回 */ -+ (void)requestWithAccessToken:(NSString *)accessToken ++ (WBHttpRequest *)requestWithAccessToken:(NSString *)accessToken url:(NSString *)url httpMethod:(NSString *)httpMethod params:(NSDictionary *)params delegate:(id)delegate withTag:(NSString *)tag; +/** + 取消网络请求接口 + 调用此接口后,将取消当前网络请求,建议同时[WBHttpRequest setDelegate:nil]; + */ +- (void)disconnect; @end @@ -569,6 +592,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @end +#pragma mark - Message Video Objects + /** 消息中包含的视频数据对象 */ @@ -604,6 +629,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @end +#pragma mark - Message Music Objects + /** 消息中包含的音乐数据对象 */ @@ -640,6 +667,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @end +#pragma mark - Message WebPage Objects + /** 消息中包含的网页数据对象 */ diff --git a/WeiboSDKDemo/libWeiboSDK/libWeiboSDK.a b/WeiboSDKDemo/libWeiboSDK/libWeiboSDK.a index 4e843f1..a2450cf 100644 Binary files a/WeiboSDKDemo/libWeiboSDK/libWeiboSDK.a and b/WeiboSDKDemo/libWeiboSDK/libWeiboSDK.a differ diff --git a/libWeiboSDK/WeiboSDK.h b/libWeiboSDK/WeiboSDK.h index b2cb21b..9f9b1b7 100644 --- a/libWeiboSDK/WeiboSDK.h +++ b/libWeiboSDK/WeiboSDK.h @@ -162,6 +162,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @end +#pragma mark - WBHttpRequest and WBHttpRequestDelegate + /** 接收并处理来自微博sdk对于网络请求接口的调用响应 以及openAPI 如inviteFriend、logOutWithToken的请求 @@ -209,16 +211,32 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) */ @interface WBHttpRequest : NSObject { - NSString *url; - NSString *httpMethod; - NSDictionary *params; - NSURLConnection *connection; NSMutableData *responseData; - - id delegate; } +/** + 用户自定义请求地址URL + */ +@property (nonatomic, retain) NSString *url; + +/** + 用户自定义请求方式 + + 支持"GET" "POST" + */ +@property (nonatomic, retain) NSString *httpMethod; + +/** + 用户自定义请求参数字典 + */ +@property (nonatomic, retain) NSDictionary *params; + +/** + WBHttpRequestDelegate对象,用于接收微博SDK对于发起的接口请求的请求的响应 + */ +@property (nonatomic, assign) id delegate; + /** 用户自定义TAG @@ -235,7 +253,7 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @param delegate WBHttpRequestDelegate对象,用于接收微博SDK对于发起的接口请求的请求的响应 @param tag 用户自定义TAG,将通过回调WBHttpRequest实例的tag属性返回 */ -+ (void)requestWithURL:(NSString *)url ++ (WBHttpRequest *)requestWithURL:(NSString *)url httpMethod:(NSString *)httpMethod params:(NSDictionary *)params delegate:(id)delegate @@ -252,12 +270,17 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @param delegate WBHttpRequestDelegate对象,用于接收微博SDK对于发起的接口请求的请求的响应 @param tag 用户自定义TAG,将通过回调WBHttpRequest实例的tag属性返回 */ -+ (void)requestWithAccessToken:(NSString *)accessToken ++ (WBHttpRequest *)requestWithAccessToken:(NSString *)accessToken url:(NSString *)url httpMethod:(NSString *)httpMethod params:(NSDictionary *)params delegate:(id)delegate withTag:(NSString *)tag; +/** + 取消网络请求接口 + 调用此接口后,将取消当前网络请求,建议同时[WBHttpRequest setDelegate:nil]; + */ +- (void)disconnect; @end @@ -569,6 +592,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @end +#pragma mark - Message Video Objects + /** 消息中包含的视频数据对象 */ @@ -604,6 +629,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @end +#pragma mark - Message Music Objects + /** 消息中包含的音乐数据对象 */ @@ -640,6 +667,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode) @end +#pragma mark - Message WebPage Objects + /** 消息中包含的网页数据对象 */ diff --git a/libWeiboSDK/libWeiboSDK.a b/libWeiboSDK/libWeiboSDK.a index 4e843f1..a2450cf 100644 Binary files a/libWeiboSDK/libWeiboSDK.a and b/libWeiboSDK/libWeiboSDK.a differ