Skip to content

Commit

Permalink
更新SDK至2.4.2
Browse files Browse the repository at this point in the history
- 添加WBHttpRequest对小写GET/POST的容错处理
- requestWithURL
requestWithAccessToken方法返回WBHttpRequest实例,开放WBHttpRequest取消接口,URL等属性
  • Loading branch information
hongtaozhy committed Jan 29, 2014
1 parent afd8625 commit 77ff36d
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
*.xcuserstate

*.xcuserstate

*.xcuserstate

WeiboSDKDemo/WeiboSDKLibDemo.xcodeproj/project.xcworkspace/xcuserdata/hongtao.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
45 changes: 37 additions & 8 deletions WeiboSDKDemo/libWeiboSDK/WeiboSDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode)

@end

#pragma mark - WBHttpRequest and WBHttpRequestDelegate

/**
接收并处理来自微博sdk对于网络请求接口的调用响应 以及openAPI
如inviteFriend、logOutWithToken的请求
Expand Down Expand Up @@ -209,16 +211,32 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode)
*/
@interface WBHttpRequest : NSObject
{
NSString *url;
NSString *httpMethod;
NSDictionary *params;

NSURLConnection *connection;
NSMutableData *responseData;

id<WBHttpRequestDelegate> 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<WBHttpRequestDelegate> delegate;

/**
用户自定义TAG
Expand All @@ -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<WBHttpRequestDelegate>)delegate
Expand All @@ -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<WBHttpRequestDelegate>)delegate
withTag:(NSString *)tag;
/**
取消网络请求接口
调用此接口后,将取消当前网络请求,建议同时[WBHttpRequest setDelegate:nil];
*/
- (void)disconnect;

@end

Expand Down Expand Up @@ -569,6 +592,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode)

@end

#pragma mark - Message Video Objects

/**
消息中包含的视频数据对象
*/
Expand Down Expand Up @@ -604,6 +629,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode)

@end

#pragma mark - Message Music Objects

/**
消息中包含的音乐数据对象
*/
Expand Down Expand Up @@ -640,6 +667,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode)

@end

#pragma mark - Message WebPage Objects

/**
消息中包含的网页数据对象
*/
Expand Down
Binary file modified WeiboSDKDemo/libWeiboSDK/libWeiboSDK.a
Binary file not shown.
45 changes: 37 additions & 8 deletions libWeiboSDK/WeiboSDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode)

@end

#pragma mark - WBHttpRequest and WBHttpRequestDelegate

/**
接收并处理来自微博sdk对于网络请求接口的调用响应 以及openAPI
如inviteFriend、logOutWithToken的请求
Expand Down Expand Up @@ -209,16 +211,32 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode)
*/
@interface WBHttpRequest : NSObject
{
NSString *url;
NSString *httpMethod;
NSDictionary *params;

NSURLConnection *connection;
NSMutableData *responseData;

id<WBHttpRequestDelegate> 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<WBHttpRequestDelegate> delegate;

/**
用户自定义TAG
Expand All @@ -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<WBHttpRequestDelegate>)delegate
Expand All @@ -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<WBHttpRequestDelegate>)delegate
withTag:(NSString *)tag;
/**
取消网络请求接口
调用此接口后,将取消当前网络请求,建议同时[WBHttpRequest setDelegate:nil];
*/
- (void)disconnect;

@end

Expand Down Expand Up @@ -569,6 +592,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode)

@end

#pragma mark - Message Video Objects

/**
消息中包含的视频数据对象
*/
Expand Down Expand Up @@ -604,6 +629,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode)

@end

#pragma mark - Message Music Objects

/**
消息中包含的音乐数据对象
*/
Expand Down Expand Up @@ -640,6 +667,8 @@ typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode)

@end

#pragma mark - Message WebPage Objects

/**
消息中包含的网页数据对象
*/
Expand Down
Binary file modified libWeiboSDK/libWeiboSDK.a
Binary file not shown.

0 comments on commit 77ff36d

Please sign in to comment.